Javatpoint Logo

how can execute a java program without main method

By: munnuk*** On: Sat Jan 28 00:47:24 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
how can execute a java program without main methodUp0Down

 
//With out using main method progrma (Use static)
class With_Out_MainMathod
{
static int i=m1();
static int m1()
{
System.out.println("With out main mathod");
System.exit(0);//-->To terminate the program
return 10;
}
}
// java6 "version" only
// java7 and 8 are not suported.
Image Created0Down

By: [email protected] On: Sat Jan 28 15:41:09 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
not possible without mainImage Created0Down

By: [email protected] On: Tue Jan 31 22:16:48 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No