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
How do you achieve singleton?
What is lazy programming?
Why java strings are immutable in nature?
What is nested loop? What is dangling else condition in it?
What are the principle concepts of oops?
What is arraylist class in java?
What do you mean by ternary operator in java?
What is the difference between member variables initialization and assignment in a constructor?
Can we create a class inside a class in java?
What is a platform?
What is an array length?
What is the advantage of preparedstatement over statement?
Can constructor be synchronized?
What is backdrop?
What is meant by attribute?