Why does the below code print \"Main\"?
public class Main
{
public static void method()
{
System.out.println(\"Main\");
}
public sta
Eclipse gives me this sort of warning when I try to do this sort of thing:
The static method XXX() from the type XXX should be accessed in a static way
Static methods do not take part in inheritance. The variable is of type Main
, so the compiler resolved your function call to Main.method()
.
For added fun, try setting m
to null
.