Yes, we can mark the main method as final.
xxxxxxxxxx
class BaseClass {
public final void show(Object o) {
System.out.println("BaseClass method");
}
}
class DerivedClass extends BaseClass {
public void show(Integer i) {
System.out.println("DerivedClass method");
}
}
public class Test {
public static final void main(String[] args) { // declaring main () method with final keyword.
BaseClass b = new BaseClass();
DerivedClass d = new DerivedClass();
b.show(new Integer(0));
d.show(new Integer(0));
}
}