This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Why Object class is parent of all Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why Object class is parent of all" Watch "Why Object class is parent of all" New topic

Why Object class is parent of all

Kartik Patel
Ranch Hand

Joined: Sep 12, 2005
Posts: 73
Can someone let me know why Object class in java is parent of any object gets created.

Chop your own wood, and it will warm you twice. - Henry Ford
Sidd Kulk
Ranch Hand

Joined: Feb 20, 2007
Posts: 152
Welcome to Javaranch!!

Java is an object oriented language and hence stresses reusability, flexibility and extensibility. Java forces the coders to code behaviour using classes(or types). Each class that a coder creates, needs to know the object oriented principles. It is not possible(and would be ludicrous) to code the standard code that makes a class understand object orientation in each and every class you form. OO practice tells us to use inheritence in case a common behaviour exists for an assortment of types. For this purpose, the Object class was made, with all the standard code, and methods required by each class. It has various methods like toString(), equals(), wait(), notify(), notifyAll() etc., which each class should have. For this, and probably few other purposes, the Object class was kept at the top of inheritence hierarchy, so that any new class would know that it has to follow OO rules and has a set of predefined methods.

Hope it helps.
I agree. Here's the link:
subject: Why Object class is parent of all
It's not a secret anymore!