What will happen when calling a static method using an object?
class Demo {
static void show() {
System.out.println("Static Method");
}
public static void main(String[] args) {
Demo obj = new Demo();
obj.show();
}
}
Compilation error
Static Method
NullPointerException
Runtime error
This question is part of this quiz :
Java Methods