Forums Register Login

Object class - the super class for all in java

+Pie Number of slices to send: Send
Hi,

This might be a simple question.

Every one knows that every class in java extends the Object class.
But we explicitly never use the extends key word still we can make use
of the methods of Object class.

How this will be acheived internally i dont know... please anyone can explain me?

Thank you,
Shanthi Naidu.




+Pie Number of slices to send: Send
 

shanthi naidu wrote: . . . we explicitly never use the extends key word still we can make use
of the methods of Object class. . . .

You can if you want to.The compiler automatically imputes "extends java.lang.Object" to every class file which does not already have an "extends" clause. Look at any of your .class files and open it with javap -c Foo, and you will see it has "extends java.lang.Object" at its head.
I didn't say it. I'm just telling you what this tiny ad said.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 977 times.
Similar Threads
why we use abstract class?
java inheritance
Java extends Object,SuperClass?
Easy Queries
java.lang.Object
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:22:35.