Can we define main method inside Abstract class? | Java Training

This Java Training”Can we define main method inside Abstract class” is providing information about static members of abstract class and why it is allowed main method inside abstract class.


 

Abstract class main() :

  • Abstract class allows concrete and abstract methods.
  • Static and Non static methods can be defined inside abstract class.
  • Hence we can define main() method inside abstract class.
  • Static methods can be accessed directly using class name.
  • Abstract class cannot be instantiated, hence we cannot access non static members directly(will see later).

 

  • User static methods can be accessed using class name.

 

Share this