Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Question: Casting Objects

$
0
0
I had a question regarding casting objects. I have always used the following syntax to create an instance of a class
Person me = new Person();


My java textbook is explaining implicit/explicit object casting and I need further clarification to feel warm and cozy.
Object me = new Person();


By implicitly casting an object in this way, what is the difference between my code and the casting? I do understand that a Person() is always an instance of Object, but Object is not always an instance of Person(), but I guess I don't just quite grasp the reasoning behind it.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>