// The main method can be overridden in the inherit process, as any other method can class A { void main() { write(1); } } class B extends A { void main() { write(2); } } class Main extends B {}