🚀 Welcome to www.UptuExam.com — Free Notes, Previous Papers, AI Search, Tutorials, Results, Syllabus, Important Questions and More...
AI is preparing your answer...
Searching notes, previous year papers, tutorials, AI content and important exam resources for you...

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