8.18 Abstract Class in Java Example

Поділитися
Вставка
  • Опубліковано 30 лис 2024

КОМЕНТАРІ • 249

  • @zyro9922
    @zyro9922 5 років тому +174

    It's 2019. Still phone can't move, dance or cook :(

    • @subsnowlink009
      @subsnowlink009 5 років тому +17

      Abstract phones

    • @alisarwar3399
      @alisarwar3399 3 роки тому +8

      its 2021 and they still cant do, what done by ramesh in 5 min

    • @rameshv2762
      @rameshv2762 3 роки тому +1

      @@alisarwar3399 😂

    • @tanveersayyed561
      @tanveersayyed561 2 роки тому +1

      Now it's 2022 I can make my phone move and dance by my own

    • @Rahul-px6zq
      @Rahul-px6zq 2 роки тому +2

      Now it's 2022🥲 sadly we got no such phones yet

  • @notbarbara2647
    @notbarbara2647 6 років тому +208

    This video is a little vague, so let me try to explain this in a more simple manner. Consider a program that deals with shapes drawn on the screen. Let's say that the shapes include rectangles, ovals, and roundrects of various colors. Three classes, Rectangle, Oval, and Roundrect, could be used to represent the three types of shapes. The three classes would have a common superclass, *Shape*, to represent features that all three shapes have in common. The Shape class could include instance variables to represent the color, position, and size of a shape, and it could include instance methods for changing the values of those properties. Now, if you think about it, there can never be any reason to construct an object of type Shape! We say that Shape is an abstract class. An abstract class is one that is not used to construct objects, but only as a basis for making subclasses. An abstract class exists only to express the common properties of all its subclasses.
    If you still don't get it, the same would apply for a class Vehicle. There is no way to 'own' a vehicle as such. You can't go up to a friend and ask: "What car do you have?", and he would respond with: "I got a vehicle man!!", there's just no way. Therefore Vehicle would be an example of an abstract class. The actual vehicle has to be a car or a truck or a motorcycle of a specific brand with a specific color, or some other "concrete" type of vehicle.
    I hope you guys get it now :)

    • @kasim7713
      @kasim7713 6 років тому +1

      Thanks you made that much simpler

    • @jadia
      @jadia 5 років тому +1

      Thanks mate for this simple explanation.

    • @willsonkingtinlaw7289
      @willsonkingtinlaw7289 5 років тому +2

      great, appreciate your sharing :D

    • @neomillmarcreas6535
      @neomillmarcreas6535 5 років тому +1

      Nice

    • @nuranferzeli5107
      @nuranferzeli5107 5 років тому +2

      vehicle and car example look like more Enum class not abstract class

  • @govegan6682
    @govegan6682 5 років тому +55

    90 minutes of lecture explained in 15 minutes thank you!!

  • @duyejamilla6897
    @duyejamilla6897 7 років тому +31

    from what i understood, it was used to update the methods, because sometimes large projects cant finish it in a short period of time, to avoid going back at the top, abstract is used to continue unfinished methods.
    Abstract methods are undefined actions/methods.
    concrete method is the finished actions/methods.

  • @RiteshKumar-ri1xq
    @RiteshKumar-ri1xq 6 років тому +1

    You have explained the concept of "Abstract Class" brilliantly in this video.

  • @kotiramamurthydavuluri1883
    @kotiramamurthydavuluri1883 8 років тому +20

    Kohli of Java. Waiting for ur tutorial daily. Daily learning a concept helping me a lot. Thanks sir.

    • @PankajDuse
      @PankajDuse 7 років тому

      Hah Sir..please keep it up

  • @rajbhardwaj3972
    @rajbhardwaj3972 3 роки тому +3

    It's 2021 and we're still searching from someone like Suresh. :')

  • @AbdulWasaeTariq
    @AbdulWasaeTariq 7 років тому +1

    The best example of Abstraction i have ever seen!

  • @skiinet_7867
    @skiinet_7867 7 років тому +2

    wow, this was such a good explanation, my professors never took the time to explain these topics this well, thank you!

  • @muleytanushri7262
    @muleytanushri7262 8 років тому +1

    What a wonderful explanation ! The actual concept of Abstract class is now cleared with the help of your video. Thanks a lot again Navin Sir !!

  • @techchamp4508
    @techchamp4508 5 років тому

    Another method should be ====> private void paymytaxes(); I am sure everyone would love that feature.

  • @isloo_boy
    @isloo_boy 4 роки тому

    completely understood " abstract class cannot be instantiated(cannot have objects) but can be inherited by other classes "

  • @SmartProgramming
    @SmartProgramming 5 років тому

    thanks for the explanation sir, thank you thank you 👍👍👍🙂🙂🙂🙂

  • @harishkumarforever515
    @harishkumarforever515 3 роки тому +1

    preparation for semesters exams from your video's 🔥🔥

  • @pradyumna25
    @pradyumna25 4 роки тому

    Best video lectures on java.... Sounds Good!!!!

  • @rajakhan570
    @rajakhan570 7 років тому

    Hi, I'm software engineering student and this fella is brilliant in explaining.

  • @vijayjangid8967
    @vijayjangid8967 4 роки тому

    Best way of teaching really understood the concept after watching only once. Really insprirng way

  • @souvikdas3616
    @souvikdas3616 4 роки тому

    very good examples that making me easy to learn.. big thank u...

  • @albinvarghese4375
    @albinvarghese4375 6 років тому +1

    Sir i am so facinated by ur explanations on java topics well explaind and brief execution .good sir keep it up and we are waiting for ur classes

  • @saicharan9043
    @saicharan9043 2 роки тому

    No words Navin, awesome 👏👏👏👏👏👏👏

  • @AttentiveAdventurer
    @AttentiveAdventurer 7 років тому +1

    Hello Navin, you are a great teacher. Thank you.

  • @ankitkumargupta9753
    @ankitkumargupta9753 3 роки тому

    Thanks for the simplified understanding

  • @shaminali769
    @shaminali769 7 років тому +1

    wonderful explanation of abstract class!!

  • @VivekKumar-ky6tm
    @VivekKumar-ky6tm 7 років тому

    Awesome again . you are best at your work. you should be appreciated for your wonderful work....

  • @judonomi
    @judonomi 5 років тому +1

    Finally! Thank you! I really needed an example that made sense. Great video :)

  • @112358henry
    @112358henry 8 років тому +1

    It's a really great introduction of abstract class! Thank you!

  • @senthilkumarmurugaiyan9831
    @senthilkumarmurugaiyan9831 7 років тому

    Awesome Explanation, Very Nice

  • @sanjusanjeev3753
    @sanjusanjeev3753 5 років тому

    Thanks for giving proper example.

  • @SurajBahadurTutorial
    @SurajBahadurTutorial 8 років тому

    wow, wt a explanation about abstract. thank you so much sir . you always gives real life example and makes me not to go back and revise . one time watch of tutorial is enough to understand.
    thank you so much clear my concept

  • @hkkabir2024
    @hkkabir2024 2 роки тому

    excellent bro. you save my days.i was learning interface so it's required to know the knowledge of abstract method and class.

  • @jackhou3865
    @jackhou3865 7 років тому

    Thanks! It really helped me to understand what my college professor didn't teach well.

  • @arvindg927
    @arvindg927 4 роки тому

    2 day of dozen doubt explained in 1 short vedio... Wow thank u ❤️❤️👏

  • @venkateshkilari6572
    @venkateshkilari6572 3 роки тому

    Excellent explanation

  • @mahmuduulkarimlincoln7932
    @mahmuduulkarimlincoln7932 7 років тому

    fantistic bro!!!! i cleared totally!!!! thanks a lot!!!

  • @AhamedKabeer-wn1jb
    @AhamedKabeer-wn1jb 5 років тому

    Superb
    Explanation

  • @vladanulardzic5859
    @vladanulardzic5859 5 років тому

    Well done ! Keep on ...

  • @vishals7425
    @vishals7425 6 років тому

    Nice video i got how abstraction works

  • @saibagam5184
    @saibagam5184 8 років тому

    Your explanation is outstanding i am looking for a video like this .Thank u sir.

  • @kyku2005
    @kyku2005 4 роки тому

    You did a great job!

  • @lalala87ful
    @lalala87ful 3 роки тому

    you are an absolute God

  • @alan6506305
    @alan6506305 7 років тому

    excellent explanation thanks

  • @hadisyadollahi7112
    @hadisyadollahi7112 7 років тому +4

    Hello Sir, Thanks for your amazing tutorial
    I didn't quite get the part we create the Show method, I assume we can directly call the showConfig() from each class, why do we nedd the last method?

  • @gowthambhat1498
    @gowthambhat1498 2 роки тому

    great example

  • @aniket6482
    @aniket6482 4 роки тому

    Thankkkkkkk you so much sir for given this super explanation |

  • @RaviKumar-rw2lx
    @RaviKumar-rw2lx 6 років тому

    u r amazing sir , thanku for such wonderful explanation

  • @backtothrones1512
    @backtothrones1512 2 роки тому +2

    It's 2022 now still phone can't dance

  • @workisworship7253
    @workisworship7253 4 роки тому +1

    Ek tarfa sir

  • @Sai-wv3hq
    @Sai-wv3hq 6 років тому

    Nice explanation

  • @debrajroy1290
    @debrajroy1290 6 років тому +1

    thanx for explaining this. this is a awesome video. can u pls tell me what are the topics require to know in java to undergo an android development training?

  • @dhivi1318
    @dhivi1318 4 роки тому

    Very useful nd clr.tq

  • @muaf8374
    @muaf8374 7 років тому

    Thanks for your teaching. Can you continue this for creating normal class inside abstract class?

  • @satoshinakamoto171
    @satoshinakamoto171 6 років тому

    can you please make a complete java project that has all the concepts of java in Eclipse? like a program that uses all the java features (or at least the important ones) in one series of videos? or a complete series of making a andriod app ?

  • @youuoyd
    @youuoyd 8 років тому

    i have to thank you mr. Telusko for this video
    i want to ask you about if you have any code for complex number abstract class
    Thank you again

  • @hsar25
    @hsar25 5 років тому

    hi Sir can you please make a video on diffrence between abstraction and interface.?

  • @Sushil2874
    @Sushil2874 8 років тому

    Ausum explanation sir..........

  • @rishabhsingh453
    @rishabhsingh453 4 роки тому +2

    But I heard somewhere that we can't create objects of abstract class, and in method show(phone obj) we are passing object of an abstract class. How. ???

    • @kamleshsilag98
      @kamleshsilag98 4 роки тому

      thats just a reference. Not actual Object

  • @ashutoshthapa3223
    @ashutoshthapa3223 7 років тому +1

    SureshPhone obj=new SureshPhone();
    also gives the same output.
    Question:
    Q1. Is it fine to do it in above mentioned way??
    Q2. If Q1 answer is no then why?
    Q3. if Q1 answer is yes then in which situation we need to use:
    ParentClass obj=new ChildClass();

  • @RezaJafari1984
    @RezaJafari1984 4 роки тому

    Every college teacher play gangsta until Telusko come in.

  • @bibhudanandadash
    @bibhudanandadash 6 років тому

    Excellent..

  • @pinky_arya
    @pinky_arya 7 років тому +1

    hello sir .nice video ..but pls give some example related to small mathematical formule like add n subtract...this phone example is little bit confusing ....I did not understand the use , the need of abstract class actuLly

  • @siddheshthavre738
    @siddheshthavre738 3 роки тому

    Thank you so much ❣️

  • @allankumar7552
    @allankumar7552 6 років тому

    A lot of thank you sirG.

  • @ManishKumar-zt5sk
    @ManishKumar-zt5sk 3 роки тому

    super explanation

  • @startech8525
    @startech8525 4 роки тому

    Thank you so much guruji😃

  • @lenimentus4698
    @lenimentus4698 8 років тому +4

    Very good video! - But why would someone need an abstract class in his java life?

    • @nithinspicy9438
      @nithinspicy9438 7 років тому +10

      LOL,i think u need to loop the video to understand it

    • @MrAbbasalrassam
      @MrAbbasalrassam 7 років тому

      Nithin Spicy so funny 😂

  • @pawemackowski1493
    @pawemackowski1493 3 роки тому

    thanks for the video :)

  • @asfiyashaik4565
    @asfiyashaik4565 4 роки тому +1

    What if I have two methods under each subclass and I want to call the methods alternatively
    eg: i have call and text methods
    and the output must be
    calling...(1st subclass)
    calling...(2nd subclass)
    texting...(1st subclass)
    texting...(2nd subclass)

  • @bellalmahtab8220
    @bellalmahtab8220 Рік тому

    Great

  • @svanaja331
    @svanaja331 2 роки тому

    awesome

  • @devbratsingh2250
    @devbratsingh2250 8 років тому +3

    in our example of phone .in public static void main.. after creating of object of iphone and samsung u had written show(obj or obj1).WHAT IS USE OF WRITTIMG THIS show()
    plz explane

  • @thomasphilip8158
    @thomasphilip8158 3 роки тому

    Thank you!!

  • @Suni777
    @Suni777 4 роки тому

    Thanks sir

  • @niteshkumarsingh7719
    @niteshkumarsingh7719 6 років тому

    Nice video

  • @AshwaniRajput29
    @AshwaniRajput29 6 років тому

    Sir can you explain this code. Why did you use ' static show(Phone obj) method ? And why did you use show(obj) ;

  • @gurug115
    @gurug115 3 роки тому

    Sir, in second phone example, why you pass the obj in show method. In main method obj. Showconfig() ; to we directly get the answer. Then why?

  • @tusharladukar6493
    @tusharladukar6493 7 років тому +3

    In 8.18 2nd example is not much cleared.

  • @waelhassan1911
    @waelhassan1911 8 років тому

    Thanks

  • @shakif3460
    @shakif3460 4 роки тому

    Good

  • @saravanabalaji1913
    @saravanabalaji1913 4 роки тому

    Wonderful Teacher .....
    I have a question sir?
    For which class you r creating object sir? @9:23
    MaheshPhone obj = new SureshPhone();
    I am little bit confused on the above step sir?...
    please help me sir......

  • @deepakguru7791
    @deepakguru7791 4 роки тому

    Why we are using a separate method canned public static void show, why can't we call showconfig from main class??

  • @ananyasinghal4624
    @ananyasinghal4624 5 років тому +1

    The abstract classes cannot be instantiated even if they contain concrete Classes??

  • @attalwaqar3969
    @attalwaqar3969 7 років тому

    like you are teaching to your self
    is it practicing or teaching

  • @micky992
    @micky992 6 років тому

    Cook and Dance for a phone sounds bizarre even as an example! Could have used something else like Vibrate and 3G/4G. Good concept explanation.

  • @MrAbbasalrassam
    @MrAbbasalrassam 7 років тому

    It makes sense to me

  • @tarungariya6818
    @tarungariya6818 6 років тому

    Sir , We can do same thing by overriding the showConfig() of Parent class "Phone" in both class Iphone and SamsungS4 and then use reference of parent class (Phone) in object passing as a parameter.......now my question is If we can do this by Overriding then how abstract class is more efficient ???? Whats the difference in between both the programs??? (Pls Ignore Grammar ,I know google is also unable to auto correct this.....lol)

  • @sathichatterjee9429
    @sathichatterjee9429 5 років тому

    In your second example you have written the method as : public static void show(phone obj) this confuses me as in I don't understand how are the objects getting passed to get the desired result because you are modifying as either show.(obj) or show.(obj1) but in public static void show(phone obj) you are not modifying it as obj or obj1 so how does the differentiate its working?

  • @snehamurya8205
    @snehamurya8205 6 років тому

    Great video. My doubt is why we we made the show() method static? I know it gave an error(Non-static method cannot be referenced from a static context) but I am not getting its concept.

    • @ajaynagireddy1267
      @ajaynagireddy1267 6 років тому

      static methods can call non static methods of other class...if one only if we have reference of that other class...in the above video, he had accessed the other class method by using reference of that other class.. so he didn't got any error.

  • @shashwatsahai4260
    @shashwatsahai4260 4 роки тому +1

    Sir, you wrote
    MaheshPhone obj = new SureshPhone();
    Why did that not give any error or warning?

    • @visheshpahuja2
      @visheshpahuja2 4 роки тому

      because Grandson can inherit features from grandfather or not

  • @achaltiwari9499
    @achaltiwari9499 5 років тому

    At 14:10 , how did you extend abstract class(Phone) without without using abstract ?

    • @shamshuddinali5695
      @shamshuddinali5695 5 років тому

      two things to understand while extending an abstract class
      1) if you extend an abstract class and override or implement all the methods in it,then there is no need of using keyword abstract.
      2)if there are 2 abstract method and you override only one,then it is compulsory to use abstract keyword.
      In the example explained above,Abstract class Phone has only one abstract method which he has overridden in child class,hence there is no error and also object of that class can be created.

  • @bayanomar8661
    @bayanomar8661 4 роки тому

    4:21 is this a compilation or syntax error?

  • @ckbapps2009
    @ckbapps2009 8 років тому

    OMG, it is so easy to understand. :D

  • @goneandwiped3521
    @goneandwiped3521 Рік тому

    Mind blown !

  • @mwstackstack7824
    @mwstackstack7824 7 років тому

    Hi naveen ,
    What is the correct way of writing classes?you have written all above classes inside same ad demo.java thing. eg class Addemo,iphone and samsung s4. So what if we create classes seperately?Is it a time wasting thing? I am a beginner.

  • @rampanda2361
    @rampanda2361 4 роки тому

    whats the use of normal methods in abstract class if its not static

  • @nehanegi4512
    @nehanegi4512 5 років тому

    sir , in this lecture you told that an abstract class can have abstract method or not . But can you give me one example of a abstract class which don't have any abstract method?

  • @lalithamuthusamy2080
    @lalithamuthusamy2080 5 років тому +1

    is it possible to initialize value in constructor in abstract class?

  • @karanrawat1659
    @karanrawat1659 4 роки тому

    Soo ,if we create an abstract method , then it will surely get overridden? (By some different class)

  • @prashantgautam7577
    @prashantgautam7577 7 років тому +1

    bro if we could define concrete methods also in abstract class then what is the use of abstract class ,we could define that concrete method in a concrete class

  • @ganeshbingi4782
    @ganeshbingi4782 5 років тому

    Sir, if abstract class doesn't able to create object then how can it being passed object of phone from method show .

  • @swapnilsonawane1858
    @swapnilsonawane1858 4 роки тому

    Sir
    By using parent refrence we can create child object but by using that object we can only call parent method
    But here you call all the method