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 is e java?

654


What are the different ways of creating thread?

666


What is append function?

655


When should I use a singleton?

663


How many types of constructors are used in java?

634






What is the difference between the size and capacity of a vector?

644


Why to use nested classes in java?

677


How are the elements of a gridbaglayout organized in java programming?

630


Can we sort hashset in java?

739


What is a blocking method in Java?

705


What are the methods available in a class?

702


What is exception handling in java?

653


What is the finalize method do?

697


What is another word for methodology?

632


What state does a thread enter when it terminates its processing in java programming?

660