Accessing superclass static method in subclass

Viewed 1313

Since a static method is restricted to a class only why is the subclass using the static method of the superclass in the below code?

public class StaticMethodEg extends Superclass {
    public static void main(String args[]) {
        System.out.println(StaticMethodEg.MyStaticMethod(2313123));
    }
}

class Superclass {
    public static int MyStaticMethod(int i) {
        Integer value = new Integer(i);
        return value + 1234;
    }
}

output

2314357
3 Answers
Related