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


Please Help Members By Posting Answers For Below Questions

How do you sort a list in java?

582


How do you define a parameter?

583


What is indexof?

547


What is the use of arraylist in java?

530


Difference between operator overloading and function overloading

613






What does the exclamation mark mean in java?

596


What is null statement?

537


Why do we need wrapper class?

536


What is Java Annotations?

557


Difference between static binding and dynamic binding?

568


What do you mean by an interface in java?

574


What is flag in python?

555


Can we use this () and super () in a method?

533


worst case complexities of Quick sort and Merge sort.

606


What is independent and dependent variables in research?

470