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 nullpointerexception?
What is the use of java?
Is empty .java file name a valid source file name?
What is the independent variable in an experiment?
What is a treeset class?
Can we increase array size dynamically in java?
Where local and global variables are stored?
What is namespace in java?
Which is best ide for java?
What is the syntax and characteristics of a lambda expression? Explain
What is the buffer limit?
What are java packages? What is the significance of packages?
Write the algorithm to check the number non-leaf nodes in a tree.
How does list work in java?
extending thread class or implementing runnable interface. Which is better? : Java thread