8.18 Abstract Class in Java Example

  Рет қаралды 384,180

Telusko

Telusko

Күн бұрын

Пікірлер: 249
@govegan6682
@govegan6682 5 жыл бұрын
90 minutes of lecture explained in 15 minutes thank you!!
@notbarbara2647
@notbarbara2647 6 жыл бұрын
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 жыл бұрын
Thanks you made that much simpler
@jadia
@jadia 6 жыл бұрын
Thanks mate for this simple explanation.
@willsonkingtinlaw7289
@willsonkingtinlaw7289 5 жыл бұрын
great, appreciate your sharing :D
@neomillmarcreas6535
@neomillmarcreas6535 5 жыл бұрын
Nice
@nuranferzeli5107
@nuranferzeli5107 5 жыл бұрын
vehicle and car example look like more Enum class not abstract class
@zyro9922
@zyro9922 5 жыл бұрын
It's 2019. Still phone can't move, dance or cook :(
@subsnowlink009
@subsnowlink009 5 жыл бұрын
Abstract phones
@alisarwar3399
@alisarwar3399 3 жыл бұрын
its 2021 and they still cant do, what done by ramesh in 5 min
@rameshv2762
@rameshv2762 3 жыл бұрын
@@alisarwar3399 😂
@tanveersayyed561
@tanveersayyed561 2 жыл бұрын
Now it's 2022 I can make my phone move and dance by my own
@Rahul-px6zq
@Rahul-px6zq 2 жыл бұрын
Now it's 2022🥲 sadly we got no such phones yet
@duyejamilla6897
@duyejamilla6897 7 жыл бұрын
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.
@kotiramamurthydavuluri1883
@kotiramamurthydavuluri1883 8 жыл бұрын
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
@RiteshKumar-ri1xq
@RiteshKumar-ri1xq 6 жыл бұрын
You have explained the concept of "Abstract Class" brilliantly in this video.
@skiinet_7867
@skiinet_7867 7 жыл бұрын
wow, this was such a good explanation, my professors never took the time to explain these topics this well, thank you!
@muleytanushri7262
@muleytanushri7262 8 жыл бұрын
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 !!
@AbdulWasaeTariq
@AbdulWasaeTariq 8 жыл бұрын
The best example of Abstraction i have ever seen!
@rajbhardwaj3972
@rajbhardwaj3972 3 жыл бұрын
It's 2021 and we're still searching from someone like Suresh. :')
@albinvarghese4375
@albinvarghese4375 6 жыл бұрын
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
@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
@isloo_boy
@isloo_boy 4 жыл бұрын
completely understood " abstract class cannot be instantiated(cannot have objects) but can be inherited by other classes "
@judonomi
@judonomi 5 жыл бұрын
Finally! Thank you! I really needed an example that made sense. Great video :)
@pradyumna25
@pradyumna25 5 жыл бұрын
Best video lectures on java.... Sounds Good!!!!
@saicharan9043
@saicharan9043 3 жыл бұрын
No words Navin, awesome 👏👏👏👏👏👏👏
@hkkabir2024
@hkkabir2024 3 жыл бұрын
excellent bro. you save my days.i was learning interface so it's required to know the knowledge of abstract method and class.
@harishkumarforever515
@harishkumarforever515 3 жыл бұрын
preparation for semesters exams from your video's 🔥🔥
@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
@SmartProgramming
@SmartProgramming 6 жыл бұрын
thanks for the explanation sir, thank you thank you 👍👍👍🙂🙂🙂🙂
@arvindg927
@arvindg927 4 жыл бұрын
2 day of dozen doubt explained in 1 short vedio... Wow thank u ❤️❤️👏
@112358henry
@112358henry 8 жыл бұрын
It's a really great introduction of abstract class! Thank you!
@jackhou3865
@jackhou3865 7 жыл бұрын
Thanks! It really helped me to understand what my college professor didn't teach well.
@AttentiveAdventurer
@AttentiveAdventurer 7 жыл бұрын
Hello Navin, you are a great teacher. Thank you.
@VivekKumar-ky6tm
@VivekKumar-ky6tm 7 жыл бұрын
Awesome again . you are best at your work. you should be appreciated for your wonderful work....
@souvikdas3616
@souvikdas3616 4 жыл бұрын
very good examples that making me easy to learn.. big thank u...
@shaminali769
@shaminali769 7 жыл бұрын
wonderful explanation of abstract class!!
@techchamp4508
@techchamp4508 5 жыл бұрын
Another method should be ====> private void paymytaxes(); I am sure everyone would love that feature.
@senthilkumarmurugaiyan9831
@senthilkumarmurugaiyan9831 7 жыл бұрын
Awesome Explanation, Very Nice
@ankitkumargupta9753
@ankitkumargupta9753 3 жыл бұрын
Thanks for the simplified understanding
@mahmuduulkarimlincoln7932
@mahmuduulkarimlincoln7932 7 жыл бұрын
fantistic bro!!!! i cleared totally!!!! thanks a lot!!!
@sanjusanjeev3753
@sanjusanjeev3753 5 жыл бұрын
Thanks for giving proper example.
@lalala87ful
@lalala87ful 3 жыл бұрын
you are an absolute God
@venkateshkilari6572
@venkateshkilari6572 3 жыл бұрын
Excellent explanation
@RaviKumar-rw2lx
@RaviKumar-rw2lx 6 жыл бұрын
u r amazing sir , thanku for such wonderful explanation
@AhamedKabeer-wn1jb
@AhamedKabeer-wn1jb 5 жыл бұрын
Superb Explanation
@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!
@aniket6482
@aniket6482 4 жыл бұрын
Thankkkkkkk you so much sir for given this super explanation |
@vishals7425
@vishals7425 7 жыл бұрын
Nice video i got how abstraction works
@vladanulardzic5859
@vladanulardzic5859 5 жыл бұрын
Well done ! Keep on ...
@Sushil2874
@Sushil2874 8 жыл бұрын
Ausum explanation sir..........
@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.
@saravanabalaji1913
@saravanabalaji1913 5 жыл бұрын
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......
@hadisyadollahi7112
@hadisyadollahi7112 8 жыл бұрын
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?
@divyasreeaedakula6006
@divyasreeaedakula6006 3 жыл бұрын
Yeah...that is also one way
@siddheshthavre738
@siddheshthavre738 3 жыл бұрын
Thank you so much ❣️
@alan6506305
@alan6506305 8 жыл бұрын
excellent explanation thanks
@bayanomar8661
@bayanomar8661 5 жыл бұрын
4:21 is this a compilation or syntax error?
@dhivi1318
@dhivi1318 5 жыл бұрын
Very useful nd clr.tq
@startech8525
@startech8525 4 жыл бұрын
Thank you so much guruji😃
@ckbapps2009
@ckbapps2009 8 жыл бұрын
OMG, it is so easy to understand. :D
@rishabhsingh453
@rishabhsingh453 4 жыл бұрын
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
@pawemackowski1493
@pawemackowski1493 3 жыл бұрын
thanks for the video :)
@workisworship7253
@workisworship7253 4 жыл бұрын
Ek tarfa sir
@gowthambhat1498
@gowthambhat1498 2 жыл бұрын
great example
@debrajroy1290
@debrajroy1290 6 жыл бұрын
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?
@allankumar7552
@allankumar7552 6 жыл бұрын
A lot of thank you sirG.
@Sai-wv3hq
@Sai-wv3hq 7 жыл бұрын
Nice explanation
@ManishKumar-zt5sk
@ManishKumar-zt5sk 4 жыл бұрын
super explanation
@RezaJafari1984
@RezaJafari1984 4 жыл бұрын
Every college teacher play gangsta until Telusko come in.
@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 ?
@ashutoshthapa3223
@ashutoshthapa3223 7 жыл бұрын
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();
@anikettambe8147
@anikettambe8147 7 жыл бұрын
Q1.yes Q3.Dynamic Method Dispatch
@HeWhoShalNotBeNamed_
@HeWhoShalNotBeNamed_ 5 жыл бұрын
This is basically polymorphism , up casting.
@muaf8374
@muaf8374 8 жыл бұрын
Thanks for your teaching. Can you continue this for creating normal class inside abstract class?
@bibhudanandadash
@bibhudanandadash 6 жыл бұрын
Excellent..
@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.
@shashwatsahai4260
@shashwatsahai4260 4 жыл бұрын
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
@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
@asfiyashaik4565
@asfiyashaik4565 4 жыл бұрын
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)
@lenimentus4698
@lenimentus4698 8 жыл бұрын
Very good video! - But why would someone need an abstract class in his java life?
@nithinspicy9438
@nithinspicy9438 7 жыл бұрын
LOL,i think u need to loop the video to understand it
@MrAbbasalrassam
@MrAbbasalrassam 7 жыл бұрын
Nithin Spicy so funny 😂
@pinky_arya
@pinky_arya 7 жыл бұрын
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
@thomasphilip8158
@thomasphilip8158 3 жыл бұрын
Thank you!!
@ananyasinghal4624
@ananyasinghal4624 5 жыл бұрын
The abstract classes cannot be instantiated even if they contain concrete Classes??
@hsar25
@hsar25 5 жыл бұрын
hi Sir can you please make a video on diffrence between abstraction and interface.?
@devbratsingh2250
@devbratsingh2250 8 жыл бұрын
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
@lawrencelanzaderas7401
@lawrencelanzaderas7401 7 жыл бұрын
I think the use of it is to call the method show()
@niteshkumarsingh7719
@niteshkumarsingh7719 6 жыл бұрын
Nice video
@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)
@prashantgautam7577
@prashantgautam7577 7 жыл бұрын
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
@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?
@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?
@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?
@deepakguru7791
@deepakguru7791 4 жыл бұрын
Why we are using a separate method canned public static void show, why can't we call showconfig from main class??
@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.
@bellalmahtab8220
@bellalmahtab8220 2 жыл бұрын
Great
@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) ;
@ashishagrawal2375
@ashishagrawal2375 8 жыл бұрын
Hello Naveen. Can't we directly call the showconfig() after creating the Object in main function.DO we Need the show() function?
@pritamparab6449
@pritamparab6449 7 жыл бұрын
ashish agrawal we can!!! he just did that to explain the concepts
@goneandwiped3521
@goneandwiped3521 2 жыл бұрын
Mind blown !
@Suni777
@Suni777 4 жыл бұрын
Thanks sir
@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.
@svanaja331
@svanaja331 2 жыл бұрын
awesome
@lalithamuthusamy2080
@lalithamuthusamy2080 5 жыл бұрын
is it possible to initialize value in constructor in abstract class?
@bishalrajbhattarai5482
@bishalrajbhattarai5482 4 жыл бұрын
No
@shakif3460
@shakif3460 4 жыл бұрын
Good
@tusharladukar6493
@tusharladukar6493 7 жыл бұрын
In 8.18 2nd example is not much cleared.
@catalintodoran4302
@catalintodoran4302 4 жыл бұрын
Bro, u good :3
@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
@KAiSKAjO
@KAiSKAjO 6 жыл бұрын
inshallah ill be big as eminem one day!
@karanrawat1659
@karanrawat1659 4 жыл бұрын
Soo ,if we create an abstract method , then it will surely get overridden? (By some different class)
@RakeshKumar-uw4dh
@RakeshKumar-uw4dh 7 жыл бұрын
if i want obj1 as parameter automatically after obj , in other words if i don't want to pass parameter in show manually after obj so what should i do? every time i have to change the parameter of function show to call output of Samsungs4 after Iphone.
@sushantsinghrathore1
@sushantsinghrathore1 4 жыл бұрын
AT LINE 37 YOU USED ";;" DOUBLE SEMICOLON HOW IT MANGED TO RUN???
@ganeshbingi4782
@ganeshbingi4782 6 жыл бұрын
Sir, if abstract class doesn't able to create object then how can it being passed object of phone from method show .
8.20 What is Interface in java with example
8:00
Telusko
Рет қаралды 172 М.
8.17 Abstract Class in Java Tutorial Theory
8:30
Telusko
Рет қаралды 223 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1,1 МЛН
Python abstract classes 👻
7:45
Bro Code
Рет қаралды 83 М.
Difference between Interface and Absract Class
30:52
Naveen AutomationLabs
Рет қаралды 183 М.
Collection and Generics in Java
14:32
Telusko
Рет қаралды 783 М.
Abstraction Can Make Your Code Worse
5:13
CodeAesthetic
Рет қаралды 681 М.
8.21 Interface in Java Tutorial with Example
13:28
Telusko
Рет қаралды 268 М.
When to use Abstract class and When to use Interface in Java
20:04
Abstract Classes and Methods in Java Explained in 7 Minutes
7:00
Coding with John
Рет қаралды 570 М.
8.16 Abstraction in Java
9:42
Telusko
Рет қаралды 303 М.
Why Use Design Patterns When Python Has Functions?
23:23
ArjanCodes
Рет қаралды 114 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН