Accessing non-static member variables from static methods (such as main)
public class StaticDemo
{
public String my_member_variable = "somedata";
public static void main (String args[])
{
// Access a non-static member from static method
System.out.println ("This generates a compiler error" +
my_member_variable );
}
}
Mistyping the name of a method when overriding
If you mistype the name, you're no longer overriding a method - you're creating an entirely new method, but with the same parameter and return type.
Comments