java - Inner class with main method doesn't compile -
abstract class manager { static void test() { system.out.println(12); } class manager1 { public static void main(string args[]) { system.out.println(manager.test()); } } }
it's producing compile time error. can abstract class have static
method void
type?
non-static inner classes cannot have static
methods - top-level , static classes can (as per jls §8.1.3).
furthermore:
system.out.println(manager.test());
manager.test()
void: can't print that.
Comments
Post a Comment