posted 12 years ago
No. What you've got there is method hiding, not overriding.
The difference is, if you call MyMainClass.main, you'll get the version in MyMainClass. If you call OverridingMain.main, you'll get the version in OverridingMain - there are two separate methods, and you don't get any polymorphic behaviour.
It's called hiding because if you just call main in OverridingMain it will call that version, whereas if you deleted that main method it would call the one in MyMainClass - the existence of the method in the subclass has "hidden" the one in the superclass, which then has to be accessed via the class name.