File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Can a JAVA program run without a main method()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Can a JAVA program run without a main method()?

Hari Dhanakoti
Greenhorn

Joined: Jan 04, 2007
Posts: 6
Here is the piece of code which runs without a main function.
Help me in this problem

class EndNow
{
public void p()
{
System.out.println("It also........");
}

}

class MainLess
{
static
{
System.out.println("hi it worked ");
EndNow e = new EndNow();
e.p();
System.exit(0);
}
}


Regards<br />Hari
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Please stop asking the same question in different forums. Continue the conversation there :
http://www.coderanch.com/t/407561/java/java/Do-Java-program-run-without


[My Blog]
All roads lead to JavaRanch
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Can a JAVA program run without a main method()?
 
Similar Threads
Do Java program can run without main function()? If not please solve this problem
Having trouble with switch, case,break,
main()
Program without main method
Program without a main method