What is static variable and static method?
Answer Posted / abnish kumar rajput
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 ? | 28 Yes | 17 No |
Post New Answer View All Answers
Does it matter in what order catch statements for filenotfoundexception and ioexception are written?
what is session in java?
What is lambda programming?
How to split arraylist elements in java?
What is string made of?
What is the latest java version?
When should you use arraylist and when should you use linkedlist?
How do you sort arrays in java?
Difference between serialization and deserialization in java?
what is the purpose of "virtual"?
Is set sorted in java?
What does sprintf return?
State some advantages of java?
What are checked exceptions?
Is singleton a bad practice?