Instead of doing Animal animal2 = new Dog(); why wouldn't you use: Dog animal2 = new Dog(); since animal2 is of the type Dog?
@smartherd6 жыл бұрын
Everything in the video is done for some purpose. Animal animal = new Dog() shows that u can assign the sub class object of Dog to the super class reference of Animal but vice versa is not possible.
@BoxerDogs6 жыл бұрын
I understand that you can assign the sub class object of Dog to the super class reference of Animal but vice versa. Here is what I don't understand. You can also do: Dog animal2 = new Dog(); animal2.eat();and still get "Dog Eating" as the result. So if create a dog object as type Animal (superclass) or as type Dog (subclass) either way the end result is still "Dog Eating." So if the result is the same whether a new dog object is of type Animal or type Dog, what is the advantage of defining a new dog object as type Animal? Why might somebody do this?
@smartherd6 жыл бұрын
It is the question of runtime. In the runtime if you are not sure what will be your object type then you should go for this approach. For example we often pass ArrayList object to a function which has super interface reference of List. If it still doesn't make things clear then here is a complete basic article on it, www.geeksforgeeks.org/referencing-subclass-objects-subclass-vs-superclass-reference/ . Hope it helps :)
@nightmarionetteprimordial35805 жыл бұрын
I hoped you finished this play list my dude! I guess he must have been planing to explain it or you had an influence on his other videos regardless he did state it takes time to make videos. Nevertheless, it took me along time to get here I hope you didn’t watch these straight through. Hahah I found out it’s good to download code and look at it to study what there doing with it from git hub. And seen this a lot! I knew it was going to be important. He is right, everything was done for a reason!
@TheDivineChords4 жыл бұрын
I do have the same question and I am not convinced with the response yet
@sangeetakumar38577 жыл бұрын
Finally !! My main Java concepts are clear after watching your simple and high quality videos/presentation. I feel more confident now to face any upcoming interviews. Thanks a lot !
@jasonsmith-iw4gm3 жыл бұрын
I am a seasoned Java programmer. But to teach my high school kid, I came across this video about polymorphism. By far, this is the BEST VIDEO for explanation on POLYMORPHISM. GOD bless you for putting together such a great video.
@tahajunaid98345 жыл бұрын
your videos are so well explained thank you. i especially like how you summarize the videos
@منامريكا-ر4ه4 жыл бұрын
You were awesome I made me strong understanding the pleomorphism
@technophile70246 жыл бұрын
Awesome tutorial, very clear to understand, top notch! Thanks for posting such a great video.
@smartherd6 жыл бұрын
Thanks
@sintushukla67092 жыл бұрын
Guy's, After filtering many lecture's for Java. I found it the best one. Thankyou @smartherd
@equinox68332 жыл бұрын
I have presentation tomorrow and u made it crystal clear .Very informative video thank you . Btw your voice is really nice
@Tikorungbaka4 жыл бұрын
When overloading, you must change either the type or the number of parameters for a method. Method overloading is done to allow us to use the same methods names for multiple methods. The purpose behind this is that, you might have different functionality implementation for the same feature based on the difference in parameters and in that scenario you definitely want the same method names to be able to relate all of them with the feature. Overriding means that a method inherited from a parent class will be changed. But, when overriding a method everything remains exactly the same except the method implementation. What the method does is changed to fit in with the needs of the child class. But, the method name, the number and types of parameters, and the return type will all remain the same.
@poojapalwai60644 жыл бұрын
The contents of your videos is very well organized and explained , thank you for the video...
@gs-rc3eq4 жыл бұрын
that is ine good explanation on run time polymorphism and upcasting with super class....thank you!!! this cleared a big confusion for me....
@rohitr67229 ай бұрын
great video sir, love ur style of explanation
@himanshusinghnegi36392 жыл бұрын
your videos are awesome !!!! i have learned many new concepts through this playlist .... so thanks for providing us such great content !!!
@smartherd2 жыл бұрын
I love teaching. U love learning. Deal!
@guruprasadr78865 жыл бұрын
Thanks a lot Sriyank Siddhartha sir, i strengthened my java knowledge and learnt some additional concepts in java through your videos
@coderbravo12753 жыл бұрын
Perfectly explained. Thank you Sir :)
@emanalikhan5912 жыл бұрын
bahi tum kitna acha samjhaty hou yaar ...itna khabi mami papa ney nhi samjhaya acha ...bahi love you hou gya bahi
@felixgerschner7 жыл бұрын
Insane quality. Thank you for these videos.
@SmartProgramming6 жыл бұрын
really great, keep it up, thank you 👍👍👍👍🙂🙂🙂🙂
@shwetatripathi90936 жыл бұрын
Simply Amazing explanation! Thanks a lot.
@shubhjeetrajput25059 ай бұрын
videos are informative and very clear, you can also tell the theoretical part for interview propectives
@rahulmandal61395 жыл бұрын
Great conceptual explanation 😊😊😊😊😊👨💻👨🏻💻
@reynaldosilva11152 жыл бұрын
Thank you for sharing your knowledge!
@Overlanding_AmericaАй бұрын
this was super helpful thank you
@mani769695 жыл бұрын
Hi Mr.Siddhartha am watching your Java Tutorial all videos and I take notes also, you have Good teaching knowledge please put more more videos for based on programming. Thank you vary much
@vaibhav08092 жыл бұрын
great...very well explained by @Smartherd
@evergreencreations62322 жыл бұрын
Tq sir for your video. I got a clarity about this topic
@zainwasem3 жыл бұрын
Top notch very clear.
@malumalu55944 жыл бұрын
thanks bro. I can understand easily by like your way of teaching.tqq
@jitendragorle7 жыл бұрын
Very nice and clear explanation, thanks siyank
@smartherd7 жыл бұрын
+jitendra Gorle thank you
@gamingsports72507 жыл бұрын
Thank you for your java tutorials This videos clear my all java concept
@smartherd7 жыл бұрын
thank you very much 😉
@shree40466 жыл бұрын
Hello sir I have downloaded all.your Java tutorials..plz continue.i wanna learn
@smartherd6 жыл бұрын
sure. But just a request do not download. watch it online if possible. This is our living
@souravkarjole7587 Жыл бұрын
is below what i stated is correct ? Thank You🙇♂🙇♂ Compile-time: The compiler checks if the methods you are trying to call exist in the reference type (interface or class) and whether they have the correct signatures. Runtime: The program runs, and when a method is called using an object, it checks the type of the actual object being referred to (which is determined at runtime). Then, it looks for the appropriate method in the actual object's class hierarchy and executes that method.
@subasubashni9014 Жыл бұрын
I think it's right! And this is what I was trying to comprehend. Thanks.
@spenceremmanuel75634 жыл бұрын
Thanks for posting such a great video!
@SurajKumar-mq9ww Жыл бұрын
nice explanation brother
@atulsoni96003 жыл бұрын
Great explanation
@BeeshoStudying2 жыл бұрын
thank you for the video
@potturikaruna41525 жыл бұрын
nice sir each and every topic vedios we need
@Masarap19595 жыл бұрын
Perfect! BUT could we need to extends keyboard when we used reference variable to other class object?
@Tikorungbaka4 жыл бұрын
we use extends keyword to define a child class so that it inherits from a parent class
@sagarvarma39194 жыл бұрын
It really helped 😊
@dhrock2517 жыл бұрын
+Smartherd great work....5 videos in one day...
@shh19096 жыл бұрын
Great videos great playlist
@samudragupta7196 жыл бұрын
Good explanation Indeed !
@smartherd6 жыл бұрын
Thanks
@tanishadixit_4 жыл бұрын
Can l use upcasting normally in java programs where l haven't declared method overriding??
@ManzoorHussain-gz1vk5 жыл бұрын
thank you very much.
@luckysuma17694 жыл бұрын
Excellent 👍
@shubhamsutar75673 жыл бұрын
nicely explain
@sachidanandapallai6016 Жыл бұрын
thank you dear
@sayanbera28 Жыл бұрын
is Runtime Polymorphism and Inheritance related? Does Runtime Polymorphism follow Inheritance concept?
@enamulhaque56977 жыл бұрын
nice Lecture bro....Plz upload a lecture about null pointer exception....
@kanikasarkar76905 жыл бұрын
It is too good to understand
@aravindsagarpa786 жыл бұрын
Very nice classes
@smartherd6 жыл бұрын
thank you.
@dhevanrajandran76325 жыл бұрын
the best video:)
@tnkwok96825 жыл бұрын
Thank you Sir for your effort in preparing the tutorial. However, I get different result when coding your upcasting example in the IDE. What I got from the following line of codes was "Animal Eating" instead of "Dog Eating": Animal animal2 = new Dog(); animal2.eat(); //result: Animal Eating
@kamal-coder Жыл бұрын
nice sir understand
@chintadakiranraj78932 жыл бұрын
sir how can i get all the videos of java from ur channel and i have subscribed already
@rahulsoni-lx5rb3 жыл бұрын
awsm🙌
@hemanthk25614 жыл бұрын
Plzz put video on multi-threading bro...
@soniafaizabenchebana31283 жыл бұрын
merci beaucoup
@veerraghavareddy7357 жыл бұрын
Please upload remaining videos by explaining remaining topics like interface,packages,applet and soon in Java because we are the follower of you
@smartherd7 жыл бұрын
+Veerraghava Reddy soon I will be up with my website.. Catch you there
@veerraghavareddy7357 жыл бұрын
Your site is not opening
@somareddy30607 жыл бұрын
Smartherd
@vibrantworld45316 жыл бұрын
Please upload more videos sir..the advanced videos
@fazilatali75456 жыл бұрын
sir plz make a vedio about the concept of polymorphism using only abstract classes
@er.abhishek11085 жыл бұрын
Well explained. There is one error. In rules of polymorphism, rule no. 3 you have to mention reference variable of child class should not point to parent class object. What you have written is confusing. You have only mentioned reference variable not reference variable of child class.
@tessythomas99104 жыл бұрын
Thanku
@eunardayangco29876 жыл бұрын
I have a class Name Database which has insert(),delete(),update() methods...I have another two class which is InventoryDatabase and UserDatabase. Both of them is inherit the Database..Now InventoryDatabase has its own methods which is getInventory as well as UserDatabase which is loginUser(). Now here is the problems. I call like this: Database db = new InventoryDatabase(); and got no error. But when I call the method like db.getInventory(); and error occurred that getInventory() is not found. I just learn Polymorphism but I don't know exactly why this error was happened. Please help me!
@indiras88335 жыл бұрын
Eventhough you have created an object for InventoryDatabase, your reference variable is of type Database. so you cant invoke subclass methods. Simply if you are having a reference of a super class for the object of a sub class, then you can only call the methods in the superclass with that reference.
@mathukumallipallavi87957 жыл бұрын
Excellent...
@smartherd7 жыл бұрын
thank you very much 😉
@manjusha96307 жыл бұрын
How can you then call eat method in animal class and print animal eating in main method You will simply create animal object then what is the use of extending
@manjusha96307 жыл бұрын
You have well explained the reference and object but compile time run time u didn’t explain
@consejosparasermejor44514 жыл бұрын
A question: Is there any way to use method overriding and overloading at the same time?
@smartherd4 жыл бұрын
Yes u can do it. Y not
@khouloudbentaoues6414 жыл бұрын
@@smartherd oveloading requires to change the parameters or the return type of a method while in overriding the signature and the return type stay the same so how is that possible ?
@tshepojaphta87186 жыл бұрын
thanks is clear
@smartherd6 жыл бұрын
Thanks alot. Make sure you visit www.smartherd.com/ . A lot of content will be there soon
@kumar172993 жыл бұрын
it's to listen. But if it is executable code, then that will more make sense.
@smartherd3 жыл бұрын
Watch next video for the demo and code mate
@chetanchavan11876 жыл бұрын
thanks
@FahimAhmed-iq7do4 жыл бұрын
class name Animal and method name is add. what the work of add method in animal class?
@manzoorahmad35197 жыл бұрын
Please Upload more videos of java
@smartherd7 жыл бұрын
+Manzoor Ahmad it's the end bro... U can now go ahead with Java programming
@sadaffatima20765 жыл бұрын
Great
@BeFox5 жыл бұрын
Bhai please hindi mein padao kasam se jabardast videos hai aapke
@varshamehra81645 жыл бұрын
nice
@vibrantworld45316 жыл бұрын
Sir please upload more videos
@mrtayyabmughal72097 жыл бұрын
Plz upload next parts
@sagarsinghrajpoot67884 жыл бұрын
Nice ;)
@manjusha96307 жыл бұрын
After upcasting if is giving child class method what is the use of upcasting
@HumphreyTembo-d4p Жыл бұрын
woww
@theartist88355 жыл бұрын
The question here is what is it that you can do with this Animal animal2 = new Dog(); that you can not do with this Dog animal2 = new Dog();
@barshabhattacharjee67884 жыл бұрын
For more : kzbin.info/www/bejne/p2O1mHl-ZteDpdU
@thilwai.42382 жыл бұрын
IT tutorial on utube is not the platform to show off your English communication skills...it would be more better if you had explained this lecture in Hindi...