Why Static variable required in java?For ex,class A
{
static int a;
int b;
}
Why static is required?

Answer Posted / sumit pal singh

static keyword is mainly used for memory management purpose. And static variable is used for declare the common property of object.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is maximum size of arraylist in java?

684


How do you declare an array in java?

733


How do I get a substring?

722


What is meant by collection in java?

760


What is method overloading in JAVA? Why is it not present in C ?

782


What kind of variables can a class consist?

774


What is the static keyword?

792


What is the meaning of immutable regarding string?

726


How does split work in java?

732


Is string is a keyword in java?

735


What does three dots mean in java?

859


How many decimal digits is 64 bit?

701


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

837


How do you reverse a word in java?

733


What is multithreading and its advantages?

791