What is static variable and static method?
Answer Posted / monika watts
STATIC VARIABLE: static variable is that variable that is
shared by all the objects of a class.means allocates memory
once even if we create any no of objects and even if we
create no object.
STATIC METHOD: first thing about static method is that we
can access static variables only with in static method.
and static methods can be called without the object of that
class.
let
class a
{
static void hello()
{
System.out.println("hello friend");
}
}
now we can access this method as hello() or a.hello();
without any object or with class name.
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What modifiers may be used with an inner class that is a member of an outer class in java programming?
How can we break singleton in java?
What is the applet security manager, and what does it provide?
How do you compare two objects?
What are the two types of java programming?
What is ‘is-a ‘ relationship in java?
Are floats faster than doubles?
What are the basic interfaces of java collections framework?
How do I find and replace in word?
What is difference between checked and unchecked exception in java?
Explain the public class modifier?
How do you end a program?
When should I use singleton pattern?
What is the use of math abs in java?
What is java and their uses?