Thursday, 9 February 2017

JAVA: Can we inherit main()?



Can we inherit main():


Yes.we can inherit the main().
Example:
package com.rameshsoft.rameshselenium;

public class InheritMainMethod extends Parent2{
         
}
class Parent2
{
          public static void main(String[] args) {
                   System.out.println("Parent class main()");
          }
         
}
OUTPUT:
Parent class main()

No comments:

Post a Comment