Why Static variable required in java?For ex,class A
{
static int a;
int b;
}
Why static is required?
Answer Posted / vaishnavi
To answer Soumya's question, instance variables are declared at class level, but the instance variables still belong to an instance/object. But static variables belong to a class.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?
Why stringbuilder is not thread safe in java?
What is ctrl m character?
What is the purpose of static keyword in java?
Is java owned by oracle?
What is the tradeoff between using an unordered array versus an ordered array?
what is the difference between a threads start() and run() methods? : Java thread
Is there is any difference between a scrollbar and a scrollpane?
Can we override data members in java?
What are the important methods of java exception class?
How do you remove spaces in java?
Can long be null in java?
What is autoboxing and unboxing?
What about interrupt() method of thread class ?
What is a generic code?