Is java.lang.Object
superclass of all the custom class/objects inherited implicitly? I thought java didn\'t support multiple inheritance. The reason I ask is i
Object
is the superclass of every other class. When your Child
class inherits from your Parent
class, it is not the child of Object
, but it is still a descendant, because its parent is a descendant of Object
.
So if you don't specify a superclass/parent, it will automatically be Object. If you do specify a parent, then Object
will still be a superclass, because it is by definition a superclass of the parent class.
Class
is not a superclass of each class, but the Object
class specifies a means to get each class's Class
with the getClass
method.