When we declare a method as static it is directly associated with the class but not with the object to access that method we dont have to create object rether than we have to simply access the method by the typing the class name and method name however in that class if there are any non static data members to access those method we have to create the object
class A{
public static void show(){
System.out.println("This is static method we can access it without creating object");
}
public static void main(String[] args){
A.show();
}
}
Comments
Post a Comment