0

Sorry about giving printscreen and not code snippets. Here is a printscreen of what my program displays when i run it

Ignoring line 19 and 20 in this program, my question is: Why do we have a differnce of what it is printed out when I call the static methods and when i call the overriding methods? Shouldn't the overriding methods display the same thing that was displayed when i called the static methods?

ChesuCR
  • 9,352
  • 5
  • 51
  • 114
psFreak
  • 1
  • 2

1 Answers1

0

Check out this post: Can I override and overload static methods in Java?

A quick summary: Static methods belong to the class instance. They cannot be overriden.

Overriding is a principle where the particular method is called at runtime. In this case, the method is chosen by the compiler at compile time.

Achooo
  • 109
  • 6