No video

8.18 Abstract Class in Java Example

  Рет қаралды 382,580

Telusko

Telusko

Күн бұрын

An abstract class is an incomplete class. An abstract class is defined with the
keyword abstract . We cannot create an object of the abstract class because it is
not complete.
These classes cannot be instantiated and are either partially implemented or not at all
implemented.
This class contains one or more abstract methods which are simply method
declarations without a body.
This class is used when common features are shared by all object.
Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-...
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-sp...
Java and Spring Framework For beginners with Spring Boot : - bit.ly/3LDMj8D
Java Tutorial for Beginners (2023) :- bit.ly/3yARVbN
Editing Monitors :
amzn.to/2RfKWgL
amzn.to/2Q665JW
amzn.to/2OUP21a.
Editing Laptop :
ASUS ROG Strix - (new version) amzn.to/2RhumwO
Camera : amzn.to/2OR56AV
lens : amzn.to/2JihtQo
Mics
amzn.to/2RlIe9F
amzn.to/2yDkx5F
Check out our website: www.telusko.com
Follow Telusko on Twitter: / navinreddy20
Follow on Facebook:
Telusko : / teluskolearnings
Navin Reddy : / navintelusko
Follow Navin Reddy on Instagram: / navinreddy20
Subscribe to our other channel:
Navin Reddy : / @navinreddy
Telusko Hindi :
/ @teluskohindi
Subscribe to the channel and learn Programming in easy way.
Java Tutorial for Beginners : goo.gl/p10QfB
Scala Tutorials for Java Developers : goo.gl/8H1aE5
C Tutorial Playlist : goo.gl/8v92pu
Android Tutorial for Beginners Playlist : goo.gl/MzlIUJ
XML Tutorial : goo.gl/Eo79do
Design Patterns in Java : goo.gl/Kd2MWE
Socket Programming in Java : goo.gl/jlMEbg
Spring MVC Tutorial : goo.gl/9ubbG2
OpenShift Tutorial for Beginners : goo.gl/s58BQH
Spring Framework with Maven : goo.gl/MaEluO
Sql Tutorial for Beginners : goo.gl/x3PrTg
String Handling in Java : goo.gl/zUdPwa
Array in Java : goo.gl/uXTaUy
Java Servlet : goo.gl/R5nHp8
Exception Handling in Java : goo.gl/N4NbAW

Пікірлер: 249
@govegan6682
@govegan6682 4 жыл бұрын
90 minutes of lecture explained in 15 minutes thank you!!
@marvel438
@marvel438 5 жыл бұрын
It's 2019. Still phone can't move, dance or cook :(
@subsnowlink009
@subsnowlink009 4 жыл бұрын
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 Жыл бұрын
Now it's 2022 I can make my phone move and dance by my own
@Rahul-px6zq
@Rahul-px6zq Жыл бұрын
Now it's 2022🥲 sadly we got no such phones yet
@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 5 жыл бұрын
Thanks you made that much simpler
@jadia
@jadia 5 жыл бұрын
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
@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
@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.
@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 !!
@albinvarghese4375
@albinvarghese4375 5 жыл бұрын
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
@judonomi
@judonomi 5 жыл бұрын
Finally! Thank you! I really needed an example that made sense. Great video :)
@AbdulWasaeTariq
@AbdulWasaeTariq 7 жыл бұрын
The best example of Abstraction i have ever seen!
@SurajBahadurTutorial
@SurajBahadurTutorial 7 жыл бұрын
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
@rajbhardwaj3972
@rajbhardwaj3972 3 жыл бұрын
It's 2021 and we're still searching from someone like Suresh. :')
@vijayjangid8967
@vijayjangid8967 4 жыл бұрын
Best way of teaching really understood the concept after watching only once. Really insprirng way
@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.
@rajakhan570
@rajakhan570 7 жыл бұрын
Hi, I'm software engineering student and this fella is brilliant in explaining.
@112358henry
@112358henry 7 жыл бұрын
It's a really great introduction of abstract class! Thank you!
@rishabhsingh453
@rishabhsingh453 3 жыл бұрын
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 3 жыл бұрын
thats just a reference. Not actual Object
@isloo_boy
@isloo_boy 4 жыл бұрын
completely understood " abstract class cannot be instantiated(cannot have objects) but can be inherited by other classes "
@AttentiveAdventurer
@AttentiveAdventurer 7 жыл бұрын
Hello Navin, you are a great teacher. Thank you.
@harishkumarforever515
@harishkumarforever515 3 жыл бұрын
preparation for semesters exams from your video's 🔥🔥
@pradyumna25
@pradyumna25 4 жыл бұрын
Best video lectures on java.... Sounds Good!!!!
@arvindg927
@arvindg927 4 жыл бұрын
2 day of dozen doubt explained in 1 short vedio... Wow thank u ❤️❤️👏
@SmartProgramming
@SmartProgramming 5 жыл бұрын
thanks for the explanation sir, thank you thank you 👍👍👍🙂🙂🙂🙂
@VivekKumar-ky6tm
@VivekKumar-ky6tm 7 жыл бұрын
Awesome again . you are best at your work. you should be appreciated for your wonderful work....
@jackhou3865
@jackhou3865 6 жыл бұрын
Thanks! It really helped me to understand what my college professor didn't teach well.
@souvikdas3616
@souvikdas3616 4 жыл бұрын
very good examples that making me easy to learn.. big thank u...
@saicharan9043
@saicharan9043 2 жыл бұрын
No words Navin, awesome 👏👏👏👏👏👏👏
@shaminali769
@shaminali769 6 жыл бұрын
wonderful explanation of abstract class!!
@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 6 жыл бұрын
Q1.yes Q3.Dynamic Method Dispatch
@HeWhoShalNotBeNamed_
@HeWhoShalNotBeNamed_ 5 жыл бұрын
This is basically polymorphism , up casting.
@ankitkumargupta9753
@ankitkumargupta9753 3 жыл бұрын
Thanks for the simplified understanding
@saibagam5184
@saibagam5184 8 жыл бұрын
Your explanation is outstanding i am looking for a video like this .Thank u sir.
@sanjusanjeev3753
@sanjusanjeev3753 4 жыл бұрын
Thanks for giving proper example.
@mahmuduulkarimlincoln7932
@mahmuduulkarimlincoln7932 7 жыл бұрын
fantistic bro!!!! i cleared totally!!!! thanks a lot!!!
@venkateshkilari6572
@venkateshkilari6572 3 жыл бұрын
Excellent explanation
@senthilkumarmurugaiyan9831
@senthilkumarmurugaiyan9831 7 жыл бұрын
Awesome Explanation, Very Nice
@hadisyadollahi7112
@hadisyadollahi7112 7 жыл бұрын
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
@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?
@lalala87ful
@lalala87ful 3 жыл бұрын
you are an absolute God
@RaviKumar-rw2lx
@RaviKumar-rw2lx 6 жыл бұрын
u r amazing sir , thanku for such wonderful explanation
@shashwatsahai4260
@shashwatsahai4260 4 жыл бұрын
Sir, you wrote MaheshPhone obj = new SureshPhone(); Why did that not give any error or warning?
@visheshpahuja2
@visheshpahuja2 3 жыл бұрын
because Grandson can inherit features from grandfather or not
@aniket6482
@aniket6482 3 жыл бұрын
Thankkkkkkk you so much sir for given this super explanation |
@vladanulardzic5859
@vladanulardzic5859 5 жыл бұрын
Well done ! Keep on ...
@AhamedKabeer-wn1jb
@AhamedKabeer-wn1jb 5 жыл бұрын
Superb Explanation
@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 ?
@gowthambhat1498
@gowthambhat1498 2 жыл бұрын
great example
@kyku2005
@kyku2005 4 жыл бұрын
You did a great job!
@asfiyashaik4565
@asfiyashaik4565 3 жыл бұрын
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)
@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.
@vishals7425
@vishals7425 6 жыл бұрын
Nice video i got how abstraction works
@chappasrinivas4447
@chappasrinivas4447 Жыл бұрын
nice explanation
@dhivi1318
@dhivi1318 4 жыл бұрын
Very useful nd clr.tq
@alan6506305
@alan6506305 7 жыл бұрын
excellent explanation thanks
@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
@lenimentus4698
@lenimentus4698 7 жыл бұрын
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 😂
@tusharladukar6493
@tusharladukar6493 7 жыл бұрын
In 8.18 2nd example is not much cleared.
@ananyasinghal4624
@ananyasinghal4624 5 жыл бұрын
The abstract classes cannot be instantiated even if they contain concrete Classes??
@Sushil2874
@Sushil2874 8 жыл бұрын
Ausum explanation sir..........
@muaf8374
@muaf8374 7 жыл бұрын
Thanks for your teaching. Can you continue this for creating normal class inside abstract class?
@siddheshthavre738
@siddheshthavre738 2 жыл бұрын
Thank you so much ❣️
@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......
@ManishKumar-zt5sk
@ManishKumar-zt5sk 3 жыл бұрын
super explanation
@workisworship7253
@workisworship7253 4 жыл бұрын
Ek tarfa sir
@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)
@bayanomar8661
@bayanomar8661 4 жыл бұрын
4:21 is this a compilation or syntax error?
@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.
@thomasphilip8158
@thomasphilip8158 3 жыл бұрын
Thank you!!
@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?
@mwstackstack7824
@mwstackstack7824 6 жыл бұрын
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.
@devbratsingh2250
@devbratsingh2250 7 жыл бұрын
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 6 жыл бұрын
I think the use of it is to call the method show()
@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
@techchamp4508
@techchamp4508 4 жыл бұрын
Another method should be ====> private void paymytaxes(); I am sure everyone would love that feature.
@nehanegi4512
@nehanegi4512 4 жыл бұрын
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?
@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
@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?
@pawemackowski1493
@pawemackowski1493 2 жыл бұрын
thanks for the video :)
@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
@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
@Sai-wv3hq
@Sai-wv3hq 6 жыл бұрын
Nice explanation
@allankumar7552
@allankumar7552 6 жыл бұрын
A lot of thank you sirG.
@lalithamuthusamy2080
@lalithamuthusamy2080 4 жыл бұрын
is it possible to initialize value in constructor in abstract class?
@bishalrajbhattarai5482
@bishalrajbhattarai5482 4 жыл бұрын
No
@deepakguru7791
@deepakguru7791 4 жыл бұрын
Why we are using a separate method canned public static void show, why can't we call showconfig from main class??
@bellalmahtab8220
@bellalmahtab8220 Жыл бұрын
Great
@digvijayyamagekar7139
@digvijayyamagekar7139 3 жыл бұрын
ramesh extended mahesh and suresh extended ramesh but mahesh and ramesh both are abstract class then how come suresh class is a concreate class ????? dosen't make any sense
@bibhudanandadash
@bibhudanandadash 6 жыл бұрын
Excellent..
@Suni777
@Suni777 4 жыл бұрын
Thanks sir
@hsar25
@hsar25 4 жыл бұрын
hi Sir can you please make a video on diffrence between abstraction and interface.?
@startech8525
@startech8525 4 жыл бұрын
Thank you so much guruji😃
@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) ;
@svanaja331
@svanaja331 2 жыл бұрын
awesome
@karanrawat1659
@karanrawat1659 4 жыл бұрын
Soo ,if we create an abstract method , then it will surely get overridden? (By some different class)
@devapujavinaykumar7320
@devapujavinaykumar7320 7 ай бұрын
why do we need to create public static void show(Iphone) method in main method
@ckbapps2009
@ckbapps2009 8 жыл бұрын
OMG, it is so easy to understand. :D
@shakif3460
@shakif3460 4 жыл бұрын
Good
@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 .
@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 5 жыл бұрын
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.
@shilpans3661
@shilpans3661 Жыл бұрын
Sir ,Maheshphone obj=new Rameshphone I didn't get this line,how can we create object of Rameshphone with Maheshphone It should be Rameshphone only write
@rampanda2361
@rampanda2361 4 жыл бұрын
whats the use of normal methods in abstract class if its not static
@waelhassan1911
@waelhassan1911 7 жыл бұрын
Thanks
@RezaJafari1984
@RezaJafari1984 4 жыл бұрын
Every college teacher play gangsta until Telusko come in.
#61 Abstract Keyword in Java
12:09
Telusko
Рет қаралды 143 М.
Abstract Class In Java Tutorial #79
8:55
Alex Lee
Рет қаралды 539 М.
🩷🩵VS👿
00:38
ISSEI / いっせい
Рет қаралды 28 МЛН
This Dumbbell Is Impossible To Lift!
01:00
Stokes Twins
Рет қаралды 37 МЛН
English or Spanish 🤣
00:16
GL Show
Рет қаралды 8 МЛН
What is JSON ?
11:56
Telusko
Рет қаралды 1,1 МЛН
Abstract Classes and Methods in Java Explained in 7 Minutes
7:00
Coding with John
Рет қаралды 505 М.
#22 Class and Object Practical in Java
15:36
Telusko
Рет қаралды 229 М.
Java Tutorials || Java OOPS  ||  Abstraction || by Durga Sir
16:09
Durga Software Solutions
Рет қаралды 172 М.
Abstraction Can Make Your Code Worse
5:13
CodeAesthetic
Рет қаралды 640 М.
Abstract Classes vs Interfaces (Java)
9:43
The Code Hard Truth
Рет қаралды 206 М.
ABSTRACT METHODS AND ABSTRACT CLASS - JAVA PROGRAMMING
26:44
Sundeep Saradhi Kanthety
Рет қаралды 226 М.
Java Strings are Immutable - Here's What That Actually Means
7:06
Coding with John
Рет қаралды 612 М.
#66 Need of Interface in Java
8:32
Telusko
Рет қаралды 125 М.
🩷🩵VS👿
00:38
ISSEI / いっせい
Рет қаралды 28 МЛН