this is how we can override main function in java....
public class animaltest
{
public static void main(String[] args)
{
horse h = new horse();
h.eat();
}
}
public class inheritmain extends animaltest
{
public static void main(String[] args)
{
System.out.print("main overrided");
}
}
but what is the benefit of overriding main??