Every class in Java IS an Object.
They behave like Objects, they can
be added to collections of type Object, they can use any method defined
in Object.
So, YES, everything (except primitives) inherit from Object in Java.
EDIT:Java takes the approach of "Everything is an Object". It sort of forces Object Oriented programming.
Example:
If class A does not extend another class it inherently extends Object.
If class A extends another class B, it is extends Object as well since B must have extended Object.
0 comments:
Post a Comment