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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With