I have two class as following:
public class Car {
public static void print() {
System.out.println(getWord());
}
public static String getWord() {
return "CAR";
}
}
public class BMW extends Car {
public static String getWord() {
return "BMW";
}
}
// main method
public static void main(String args[]) {
BMW.print();
}
After I run above sample, this output is printed:
CAR
My question is: Why is the method getWord()
not overriden?