What is static variable and static method?
Answer Posted / ahmad
Static variables are those variables that are declared with
static keyword of java.Static variables are declared once
into a class and are available entire class.Static variables
are common to all objects of class.Static variables can be
accessed by non-static methods.Whereas Static methods are
those which are declared with static keyword and can only be
accessed static variables.If we have Static method then we
can call it directly with class_name.And static variables
and methods both are related to class,whereas non-static
variables and methods are related to object.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is static import in java?
What does || || mean in math?
Explain spliterator in java8?
What is the use of math abs in java?
How does singleton class work?
Explain method overloading?
Write a program to reverse array in place?
In a class implementing an interface, can we change the value of any variable defined in the interface?
How do you add an element to an arraylist in java?
How can we make a class virtual?
How do you escape json?
What is the name of the java compiler?
What is an object class?
What is the use of toarray () in java?
What does next mean in java?