When we can access the static data member without creating
the object what is the need of the object in java.
Answer Posted / paras bist
Static data is class level data,while objects contain
values of non static instancs varibles.
diffrent object contains diffrent values of instance
varibles ,
but all object can share same vale of static data.
Class abc{
int i;
int j;
static int x=10;
//-----some more code
}
diffrent object contain diffrent values of i&j,
but all object can share one value of x(ie 10 coz it is
static).
static data is accessed by class name and object also.
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Can memory leak in java?
what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread
What is the difference between jfc & wfc?
What are meta-annotations?
How do you override a variable in java?
What invokes a thread's run() method in java programming?
What is meant by final class?
What are the various access specifiers for java classes?
What is anagram number?
What is void in java?
How can you read content from file in java?
What do you understand by weak reference?
What is an accessor?
What does += mean in java?
How to write custom exception in java?