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
Explain the difference between a Thread and a Process.
What is locale?
What does it mean to be immutable?
How to access arraylist elements in java?
What is backdrop?
Differentiate between == and equals().
How many types of threads are there in java?
What is the use of 'super' keyword inside a constructor?
What are the important features of Java 10 release?
What is arraylist class in java?
Can you tell me range of byte?
How does queue work in java?
How to change the priority of thread or how to set the priority of thread?
What is the purpose of void class?
What is a heavyweight component?