I know that we can write main method in abstract class, but what we can achieve from it ?
public abstract class Sample
{
public static void main(Strin
As Zeeshan already said, since the main
method is static, it does not require an instance to be called. As to what can be achieved by placing the main method in an abstract class, well nothing more or less than placing it in any other class.
Typically, the main
method is either placed in a class of its own or in a class that is central to the application. If that class happens to be abstract, so be it.