Why we need object class in java and what is the purpose ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Why we need object class in java and what is the purpose ?

12th Aug 2019, 8:55 AM
Programmer Raja
Programmer Raja - avatar
10 Answers
+ 2
To have a parent class that all top level classes implicitly inherit from.
12th Aug 2019, 11:12 PM
Sonic
Sonic - avatar
+ 6
The class isnt the object it's a template/the blueprints of what your object will be when you create an object of that class. Objects have state and behaviours meaning you can call methods on these objects and many other things which you cant do with primitive types.
12th Aug 2019, 9:18 AM
D_Stark
D_Stark - avatar
+ 5
Classes in general are used to model real-world concepts. Java is an object oriented programming language, meaning objects are the way to go, and classes are the blueprints for those objects
12th Aug 2019, 10:21 AM
Dlite
Dlite - avatar
+ 4
Programmer Raja Please revise your question with more clarification. 🙏 Your question, as it stands, is unclear and ambiguous as it can be interpreted to mean different things. Provide addition context on what you're trying to understand so your question is much clearer to anyone willing to help. For this question, in particular, what do you mean by "object class in Java"? This isn't a proper term in Java. 🤔 In my attempt to guess, you could be asking any of the following: 1. What is a class in Java? 2. Why are classes needed to create an object in Java? 3. Why does Java require everything to be defined in a class? These are just a few different meanings I considered and each have different answers. As much as I would like to answer your question, I would have to provide several answers and hope one of them was close to what you were asking about. Otherwise, it would have been a complete waste of my time to even have attempted to answer. 🤓 I hope this advise makes sense. 😉👌
14th Aug 2019, 10:13 PM
David Carroll
David Carroll - avatar
+ 3
Object class is the parent of all classes so its stores the references off all classes like in polymorphsim
13th Aug 2019, 1:03 PM
Zebi Zebi
Zebi Zebi - avatar
+ 2
Its very important to simulate real word With classes you can build a car and separate a huge idea to a simple classes you can code and its help in group working every one can take a class and then you will combine all classes together
12th Aug 2019, 12:58 PM
Mamdouh Altabaa
Mamdouh Altabaa - avatar
+ 2
Java is by default a OOP so monolithic program doesn't exist in Java
13th Aug 2019, 5:14 AM
Aditya
Aditya - avatar
+ 1
For encapsulation
13th Aug 2019, 4:45 AM
\•/
\•/ - avatar
+ 1
Platform independence
13th Aug 2019, 6:41 AM
Hitesh Agrawal
0
David Carroll sorry for that There is class called object in java Which is the super class all class we create So what is the purpose of that object class need to parent for all class ?
15th Aug 2019, 7:28 AM
Programmer Raja
Programmer Raja - avatar