📌 Subscribe For The Latest Videos: bit.ly/36H70sy 📌 . 💻 All Java Tutorials: bit.ly/JavaTutorialsKZbin 💻 . 🤖 Learn Java In 3 Hours: bit.ly/JavaIn3Hours 🤖
@jbayg3 ай бұрын
OH MY GOODNESS THIS IS THE CLEAREST EXPLANATION OF UPCASTING THANK YOU
@chandan07talreja6 жыл бұрын
Awesome man. A visual representation always helps in better understanding. Keep posting more videos.
@raxkhmanLite4 жыл бұрын
Indeed, this video is one of the best explanation on casting of objects out there!!!
@BillBarnum4 жыл бұрын
Thanks for the feedback. I'm glad you liked the video!
@bennails34473 жыл бұрын
Legendary video on the subject. The best've I found on KZbin so far!
@BillBarnum3 жыл бұрын
Wow, thanks!
@sp_aryan62 жыл бұрын
from India, watching it the night before exam. thanks a lot for making a short easy to understand video.
@BillBarnum2 жыл бұрын
Good luck on your exam!
@unityorder4 жыл бұрын
After one day trying to understand Casting and finally just 5 minutes explained very clearly to be ok ! thanks !!!
@BillBarnum4 жыл бұрын
Thanks for the feedback Amine. I'm glad you like the video.
@CindyMcGuirk6 жыл бұрын
Exactly what I needed to know at this moment. Thanks, Bill!
@HungryBirdStephenHaokip5 жыл бұрын
Thank you bill been stuck here for a long time now... downcasting is clear
@_mantis4 жыл бұрын
I am really thankful for this tutorial. Keep up the good work!
@BillBarnum4 жыл бұрын
Thanks for the feedback! I'm glad that you found it useful.
@zackaoz10345 жыл бұрын
I love you Bill, finally a full tutorial with all possible examples.
@hiteshchalise39886 жыл бұрын
really informative, and perfect explanation, thanks bill.
@HighOctaneNews5702 жыл бұрын
Finally someone who explains correctly this topic. Thank you Sir.
@BillBarnum2 жыл бұрын
Thanks for watching and commenting, Alejandro.
@prabhatdahal34164 жыл бұрын
Really helpful video man💯💯💯. keep uploading more videos . Thank you so much Bill ❤❤
@abdulaziz_xi4 жыл бұрын
Thanks man … Great explanation
@Astrovic13 жыл бұрын
it is midnight and will be writing an important exam at 8am :D after this video i finally got the object casting thank you haha :D
@BillBarnum3 жыл бұрын
Good luck on your exam!
@robertastutlys86414 жыл бұрын
Exactly what i needed. Thanks for this great content!
@abdur19963 жыл бұрын
Was looking for C# but this was very relavent regardless. I really really like the stack and heap insights in the tutorial as it helps understand whats *really* going on
@BillBarnum3 жыл бұрын
Thanks for the feedback!
@SoftwareTestSolutions3 жыл бұрын
That is a great explanation... Thanks for the video!
@obit63803 жыл бұрын
Thanks for the video! Very clear and to the point presentation!
@BillBarnum3 жыл бұрын
Thanks for the feedback, OBIT.
@anastasijad48303 жыл бұрын
Thank you sir! God bless you
@ayoubanbara16855 жыл бұрын
thanks you from morocco
@rho89312 жыл бұрын
Thank you so much for this awesome tutorial!
@BillBarnum2 жыл бұрын
Glad it was helpful, Rhoad!
@criquetteable6 жыл бұрын
really good! perfect explanation thanks a lot
@joaovalerio81372 жыл бұрын
Brilliant explanation!
@BillBarnum2 жыл бұрын
Thanks for watching and commenting, João!
@louishou7816 жыл бұрын
this video is awesome - thank you so much
@نفرال-فيرزاتشي6 жыл бұрын
you're the best, keep it up
@s2k_love4925 жыл бұрын
Excellent, helped a lot. Thank you!
@serhatgundem3 жыл бұрын
Thanks a looooooot. You are great.
@BillBarnum3 жыл бұрын
Thanks for the feedback Serhat. I'm had you liked the video!
@18DZ3 жыл бұрын
Exactly what I needed before my exam!
@NikitaSafronov-y6i2 жыл бұрын
OMGGGG!!! You are a genius!!! It's awesome =)
@BillBarnum2 жыл бұрын
Thanks for watching and commenting!
@kbuvanesh5347 Жыл бұрын
Very good explaination sir love ❤️ from India 🇮🇳
@rajdhar1235 Жыл бұрын
Amazing explanation. Thank you.
@ИльяХимченко-н2и5 жыл бұрын
Thanks a lot!
@AyumiNoran4 жыл бұрын
Thank you!
@BillBarnum4 жыл бұрын
Thanks for the feedback. I'm glad you found it helpful.
@zhenyuanhe60714 жыл бұрын
Thanks a lot! Clear enough:)
@funnybunny31882 жыл бұрын
Very good explanation i got my points
@BillBarnum2 жыл бұрын
Thanks for watching and commenting.
@rafaybbx2 жыл бұрын
amazing explanation
@BillBarnum2 жыл бұрын
Glad you liked it
@johncerpa37825 жыл бұрын
Great video
@camnooten1104 жыл бұрын
Thank you, this really helps
@IluSsIoNnN3 жыл бұрын
Thank you my good sir !!!!
@BillBarnum3 жыл бұрын
Thanks for the comment, IluSsIoNnN.
@NikitaSafronov-y6i2 жыл бұрын
01:10 does not Lion class inherit controlTemp() as well? If we talk about general inheritance as it is. So, in total Lion method has access to next method (via inheritance) eat() - from Animal sleep() - from Animal controlTemp() - from mammal and one own unique method roar() ear() @overridden
@jackwesh29764 жыл бұрын
Loved it Thanks Much
@BillBarnum4 жыл бұрын
Thanks for the feedback!
@langstonhodges58634 жыл бұрын
Do these same concepts hold true with the fields for the classes when upcasting and downcasting? This video only covers the interactions with methods.
@BillBarnum4 жыл бұрын
Yes, it would work the same way with fields.
@langstonhodges58634 жыл бұрын
Bill Barnum Thank you very much it all makes since now.
@yalakaturi.saidivya91582 жыл бұрын
Mutilple times of casting,by using single object is possible or not?
@BillBarnum2 жыл бұрын
Yes. When you cast an object, you aren't changing any data. You are just "making promises" to the compiler that it is pointing at an object of the type you are casting it as.
@younesred1124 жыл бұрын
Thank you so much !! awesome explanition
@lazry17732 жыл бұрын
great video
@BillBarnum2 жыл бұрын
Thanks for watching and commenting, Lazry!
@ginopaolettigeuna19463 жыл бұрын
excellent!
@BillBarnum3 жыл бұрын
Thanks for the feedback Gino.
@real_hello_kitty4 жыл бұрын
Thanks.👍
@kakashi999083 жыл бұрын
So what are the limitations of doing: Lion jen = new Lion()?
@BillBarnum3 жыл бұрын
I recommend my video on Polymorphism. I think it will answer your question: kzbin.info/www/bejne/mYbLZIRvoZiEY5I
@kakashi999083 жыл бұрын
@@BillBarnum I watched it but am still a little confused. In the classes Lion extends mammal, mammal extends animal so wouldn't Lion jen = new Lion() work without having to type cast any methods? Basically I am confused when you use Animal jen in place of Lion jen because they seem to do the same thing.
@BillBarnum3 жыл бұрын
@@kakashi99908 Let's take two variables: Animal alex = new Lion(); Lion jen = new Lion(); The methods available to alex are only those that are declared in Animal. So we could do alex.eat() and alex.sleep(), but we couldn't do alex.roar(), because the alex variable is an Animal and there is no roar() in the Animal class. On the other hand, the jen variable is declared as a Lion. Lion classes have the roar() method, so we COULD do jen.roar() The variable type determines what methods are available. The object type determines what version of the method is run.
@ramzirebai36612 жыл бұрын
Thank you so much
@BillBarnum2 жыл бұрын
Thanks for watching and commenting Ramzi!
@jamesbakis63304 ай бұрын
What a fucking amazing description lol
@wasimpatel26182 жыл бұрын
i cant hear the sentence at 4:02. can anybody tell me pls.
@BillBarnum2 жыл бұрын
"This is legal because we are assuring the compiler that Jen is, in fact, pointing at a Lion type object. "
@wasimpatel26182 жыл бұрын
@@BillBarnum thank you so much sir for explaining, I misheard is, in fact to "isn't fact ".
@spencerrobles9373 Жыл бұрын
Good video
@jangul82305 жыл бұрын
v.good sir
@sweeren36195 жыл бұрын
ty so much
@moses.muchemi4 жыл бұрын
Lifesaver
@asitkumarsahu52113 жыл бұрын
How to cast string to user defined object type
@BillBarnum3 жыл бұрын
Here are a couple of examples: Object x = new String("test 123"); //upcasting example String y = (String)x; //downcasting example
@ash25212 жыл бұрын
very descriptive
@BillBarnum2 жыл бұрын
Thanks for watching and the comment, Aashish!
@Aloksheoran3 жыл бұрын
Good for mugging up only
@simongadd85453 жыл бұрын
Explained an hour of university lecture content in just under 6 minutes and so much better. Maybe I should pay you instead?
@BillBarnum3 жыл бұрын
Thanks for the comment, Simon. I'm glad you thought it was a useful video!
@Subhash_VCU Жыл бұрын
Animal jen = new lion() Jen. Controltemp() , a valid statement??
@jsonwann89084 жыл бұрын
thanks...
@maharun02 жыл бұрын
I have a serious confusion. Here it is: Animal
@BillBarnum2 жыл бұрын
You can't override the sleep() function in the Animal class because that's where it originates. You can override sleep in a subclass that would otherwise inherit sleep() Does that answer your question?
@adriansalabanzi22506 жыл бұрын
cool.
@adityakuricheti66532 жыл бұрын
lion l = new lion(); This is valid So will it come under downcasting?
@BillBarnum2 жыл бұрын
Good question. In that case, the variable and object type are the same, so it isn't casting.
@adityakuricheti66532 жыл бұрын
@@BillBarnum ok thanks
@khorLDW4 жыл бұрын
poor joe
@BillBarnum4 жыл бұрын
That's what happens when you don't follow the rules of Java. 🙂
@xrealmob_10374 жыл бұрын
tx G
@barshabhattacharjee67884 жыл бұрын
For more visit: kzbin.info/www/bejne/rZPViKOqYpKWndk
@NikitaSafronov-y6i2 жыл бұрын
+
@mehmetali6272 жыл бұрын
Good job bro
@BillBarnum2 жыл бұрын
Thanks
@mehmetali6272 жыл бұрын
@@BillBarnum you are welcome sir. You've saved my life in college.