What do you mean by object in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What do you mean by object in java?

and how it is uses in java.

6th Mar 2017, 1:37 PM
Akash Kumar
Akash Kumar - avatar
4 Answers
+ 2
object is an instance of a class. Consider a class animal.Then its object could be dog,cat, etc. You canNOT tell an animal to BARK, but you can tell a Dog to bark.Similarly, in java, you cannot call a method(here,bark is a method) without creating an object(This can be done with STATIC keyword, though).
6th Mar 2017, 2:26 PM
Meharban Singh
Meharban Singh - avatar
+ 1
@Abdul , I think you got it wrong man. You are talking about attributes, and he needs object
6th Mar 2017, 3:11 PM
Meharban Singh
Meharban Singh - avatar
+ 1
An object is like a xerox copy of any form(I.e class) which can be further used to call the function and initialize the method parameters. for ex... abc ob = new abc(); //creating object ob of class abc ob.display(5,6); //with the help of object calling display function to initilaze the value in its parameter ob.display(6,9);//now again calling same function with different parameter .... it is just like a xerox copy of a form that can be used no of times to fill different parameters
7th Mar 2017, 10:55 AM
Avinash yadav
Avinash yadav - avatar
- 1
Java is an object-orientated language meaning that the whole code itself runs off of objects. When writing Java code you will use lots of objects and classes, many of which extend from other classes.
6th Mar 2017, 1:43 PM
mThompsett
mThompsett - avatar