While i was reading java book, i came across “Every class extends class Object“…but if want a class B to extend class A…..but Class B will be now having multiple inheritance,one from Object class and one from Class A.How the conflict is resolved.
Can anyone explain?
While i was reading java book, i came across Every class extends class Object
Share
First of all,
Object classis the super/base/parent class of every class including user-defined classes.So even if we don’t mention it explicitly, the user-defined classes extends Object class by default.
Morevoer, Object class implements a set of methods and variables which are common to all the objects being created in the application. This is the main reason why we have Object class as a base class for all the other classes.
For eg:
hashCode()– this method creates a unique identity for each of the object being created in JVM.