Reputation: 740
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 a compile time error. Can an abstract class have a static
method with void
type?
Upvotes: 3
Views: 111
Reputation: 129507
Non-static inner classes cannot have static
methods - only top-level and static classes can (as per JLS §8.1.3).
Furthermore:
System.out.println(Manager.test());
Manager.test()
is void: you can't print that.
Upvotes: 12