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

Is java a utf 8 string?

542


What are the two environment variables that must be set in order to run any java programs?

539


In Java list the methods that can be overridden?

577


Is 0 true or false?

519


What is the default execution method in java?

632






What are the major drawbacks of external iteration?

581


What is a null point?

566


What is a war file?

559


What is another word for methodology?

526


What is the impact of declaring a method as final?

568


How does indexof work?

515


What is a numeric format?

578


What are streams?

642


What is the use of static class?

555


Explain what pure virtual function is?

608