![]() | Session 5 | ![]() |
Object class
All classes have a parent class (have a super class) except one. The class at the top of the Java class hierarchy is called Object. If a class definition does not extend a parent class then it automatically has Object as a parent class. Ultimately all classes have Object as an ancestor.
This means that all classes in Java share some common characteristics. Those characteristics are defined in Object. For example, all classes have a toString() method because the class Object defines that method so all classes get it by inheritance. Usually when we write a class we override toString() method.
Useful link:
Check the other methods of Object class in API.
![]() | Session 5 | ![]() |

