+ 2
What do you mean by object in java?
and how it is uses in java.
4 Respuestas
+ 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).
+ 1
@Abdul , I think you got it wrong man. You are talking about attributes, and he needs object
+ 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
- 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.