how to execute a program without main().


how to execute a program without main().


PROGRAM First3.java
           public class First3
               {
                  static
                   {
                      System.out.println("It is executing without main()......");
                       System.exit(0);
                        } 
                         } 


                Output –







                1. PROGRAM :
                2. public class First
                3. {
                4. public static void main()
                5. {
                6. System.out.println("It is overloaded main.....");
                7. }
                8. static
                9. {
                10. main();
                11. }
                12. public static void main(String args[])
                13. {
                14. System.out.println("It is invoked by JRE");
                15. }
                16. }


                Output –










                Signature of Method –


                modifier returnType methodName(Argument list)

                {
                               -------------
                               -------------
                               -------------          

                }












                No comments:

                Post a Comment