Saturday, December 10, 2016

Can a class be declared static ?

abstract static class OutsideClass {

static void m1(){
System.out.println("m1 method");
}

public static void main(String args[]){
OutsideClass.m1();
}
}

Answer : 

No because all classes are already static by nature because anyway a class exists only one time

No comments:

Post a Comment