+ 1

Why object class is parent of every class

13th Jul 2018, 5:20 AM
Nilesh Tammewar
Nilesh Tammewar - avatar
4 Respostas
+ 1
"Every class is a descendant, direct or indirect, of the Object class." reference source- https://docs.oracle.com/javase/tutorial/java/IandI/objectclass.html
13th Jul 2018, 5:31 AM
ODLNT
ODLNT - avatar
0
but why
13th Jul 2018, 7:50 AM
Nilesh Tammewar
Nilesh Tammewar - avatar
0
There 12 instance methods that are properties of the Object class and each one performs a specific task when invoked. Due to inheritance, any class created in Java has access to these 12 methods thus allowing code reuse as opposed to rewriting code. "Inheritance lets programmers create new classes that share some of the attributes of existing classes. This lets us build on previous work without reinventing the wheel." source - https://stackify.com/oops-concepts-in-java/ Follow link below for description of the 12 instance methods of Object class. https://docs.oracle.com/javase/tutorial/java/IandI/objectclass.html
13th Jul 2018, 12:58 PM
ODLNT
ODLNT - avatar
0
thank you
13th Jul 2018, 1:21 PM
Nilesh Tammewar
Nilesh Tammewar - avatar