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


Please Help Members By Posting Answers For Below Questions

What checkbox method allows you to tell if a checkbox is checked?

539


What is java in layman terms?

529


What are static blocks and static initalizers in java ?

587


What is ternary operator?

568


Can we use return in constructor?

495






What is the definition of tree ?

589


Which is better list or arraylist in java?

495


What is the meaning of course?

583


Explain reverse a linked list iterative solution in java?

500


How we can skip finally block of exception even if some exception occurs in the exception block in java?

526


whar are the draw backs of programming lang step by step in Clang and next in C++ and next and in Java nad in .Net

1661


State two differences between C and Java.

695


What is the covariant return type?

578


What restrictions are placed on method overriding?

642


Why do we need singleton?

541