What is static variable and static method?

Answers were Sorted based on User's Feedback



What is static variable and static method?..

Answer / aditya

static variables are class variables.They are globally
declared with the keyword "static".They can be intialised at
the declaration time (or) they can be initialised in static
block.They can accessed by using thier class name
(class name.static variable name).Static variables can also
be accessed by the obj name but to make the difference
between the instance variables and static variables they are
accessed using class name outside the class.Static methods
are the methods that can access only static variables,they
can access instance variables also but only through the
object of the instance variables not directly.Their values
are stored in heap memory.Any changes to the static
variables reflect in heap memory.

Is This Answer Correct ?    0 Yes 0 No

What is static variable and static method?..

Answer / digant mehta

tatic variables are classes variables not instance
variables .They are instantianted only once for a
class.They are initialised at class load time.
Static method can be referenced with the name of the name
of the particular object of that class. That's how the
library methods like System.out.println works.

Is This Answer Correct ?    0 Yes 0 No

What is static variable and static method?..

Answer / kutta

a variable declared inside a method is local to that method.
it can't be accessed outside the method. if a variable
declared in a class means its a global variable.if we
declare a variable with static keyword in a class means it
can be accessed by all the class.

Is This Answer Correct ?    0 Yes 0 No

What is static variable and static method?..

Answer / qaisarayub

static variables are classes variables not instance
variables .They are instantianted only once for a
class.They are initialised at class load time.
Static method can be referenced with the name of the name
of the particular object of that class. That's how the
library methods like System.out.println works.

Is This Answer Correct ?    0 Yes 0 No

What is static variable and static method?..

Answer / 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

What is static variable and static method?..

Answer / ankit

static variable are those variable which call with the hepl
of the class name and they are not initiated.

Is This Answer Correct ?    0 Yes 0 No

What is static variable and static method?..

Answer / rajiv sairam

Static variable can be modified, only a single copy is maintained for the objects,it stays in memory until we delete it manually,accessing is directly with the class name


Static method can access only static data with the class name, no need of creating objects.

Is This Answer Correct ?    0 Yes 0 No

What is static variable and static method?..

Answer / subhen

Have a look at the following post to uunderstand why do we
use static variable and static class in our programme.

http://blog.subhendu.info/index.php/why-to-use-static-
methods-class-and-static-variable/

Is This Answer Correct ?    1 Yes 2 No

What is static variable and static method?..

Answer / bijeesh.p

A static variable ,also reffered to as a class variable
which exists across instances of a class.
By default,all variables are created as instance
variables(A variable related to a single instance of a
class.Each time an instance of a class is created,the
system creates one copy of the instance variables related
to that class).To make a class variable,you must explicitly
declare the variable static.

Is This Answer Correct ?    16 Yes 18 No

What is static variable and static method?..

Answer / anupam sharma

static variables are classes variables not instance
variables .They are hold the value and instantianted only
once for a
class.They are initialised at class load time.
Static method can be referenced with the name of the name
of the particular object of that class. That's how the
library methods like System.out.println works.

Is This Answer Correct ?    16 Yes 18 No

Post New Answer

More Core Java Interview Questions

When finalize method is called?

3 Answers  


Is void a return type?

0 Answers  


What is the indent key?

0 Answers  


What are some alternatives to inheritance?

0 Answers  


What is the order of arraylist in java?

0 Answers  






How to change the priority of thread or how to set the priority of thread?

0 Answers  


What is meant by event handling in SAX parser?

1 Answers   Ness Technologies,


wht is customised exception?

1 Answers   Logica CMG, Novell, Prudential,


What is variable and example?

0 Answers  


is it mandatory to deaclare all variables public static fianl in interfaces?if i declare like in the below program, public interface A { public static final int I=0; int j=0; } in interface A,what is the difference between I,j?

2 Answers  


How can we make a class singleton?

0 Answers  


What is stringreader?

0 Answers  


Categories