Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Java by (6.5k points)
edited by

Could someone tell me what is an Object in JAVA and how do we implement it?

1 Answer

0 votes
by (11.3k points)
edited by

An object is an instance of a class in JAVA. Now, what does that mean? A class can be understood as a template of an entity. Suppose, we talk about a table. A table can have various lengths, sizes, and wood types as its attributes and various functionalities as its behavior, for example, whether it's adjustable or not or whether it has wheels. A class simply has a predefined or null values for these attributes and just has these behaviors as its functions. When we create an object of a class, we get to specify all these attributes and call on the behaviors of the object. We can create as many instances of the class as we want and all these instances can work independently and have different values. 

To create an object of Class A, we do the following:

A obj = new A();

Now, obj is an object of class A.

This is one of the most basic concepts in JAVA and a fundamental building block for coding in the objected-oriented platform that JAVA provides. To learn more from a beginners' point of view and get your concepts clear, you can refer to this video:

Browse Categories