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
What is gui programming?
What is meant by call by reference?
Does variable declaration allocate memory?
What are different types of inner classes ?
Explain reverse a linked list recursive java solution?
Give me an example of array and linked list? Where they can be used?
What is a finally block?
What is the size of a string in java?
Can a class have multiple constructors?
How can we make copy of a java object?
What is java command?
Are arrays immutable in java?
Similarity and difference between static block and static method ?
Why does my function print none?
How does sublist works in java?