Give some brief defenition for
1. Static Variables
2. Static Functions
3. Instance Variable
Static Variables
Static variables are class variables that are shared by all instance of class ..
1)It is a variable which belongs to the class and not to object(instance).
2)Static variables are initialized only once , at the start of the execution . These variables will be initialized first, before the initialization of any instance variables.
3)A single copy to be shared by all instances of the class.
4)A static variable can be accessed directly by the class name and doesn�t need any object.
Static Methods
Static method is the method which belongs to the class and not to the object(instance).
1)A static method can access only static data. It can not access non-static data (instance variables).
2)A static method can call only other static methods and can not call a non-static method from it.
3)A static method can be accessed directly by the class name and doesn�t need any object.
4)A static method cannot refer to "this" or "super" keywords in anyway.
Instance Variables
An instance variable is a variable which is 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.An instance variable is declared inside a class, but not within a method.
For more information, visit the following links:
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }
class a{ static int a=1; static void display(){ System.out.println("it is static methode"+a); } } class main{ public static void main(string args[]){ a obj=new a();//can ,t requirement of it a.display(); //it is directly call by class name
} }