"static members" are accessed only "static and non static methods".
ex : static int b=200; (static member)
"non static members" are accessed by "non static methods".
ex : int a=100; (non static member)
if we want to access any data members directly in a main() then we use "static members".
ex :
public static void main(String args[])
{
System.out.println("static variable b :"+b); // execute
System.out.println("\nnon static variable a :"+a); // error
}
ex : static int b=200; (static member)
"non static members" are accessed by "non static methods".
ex : int a=100; (non static member)
if we want to access any data members directly in a main() then we use "static members".
ex :
public static void main(String args[])
{
System.out.println("static variable b :"+b); // execute
System.out.println("\nnon static variable a :"+a); // error
}