File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Program without a main method

 
Anshul Kapoor
Greenhorn
Posts: 5
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any other way of creating a program without a main method ?
public class Test{
static{
System.out.println("Without a Main Method");
System.exit(1);

}
}
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on what your definition of "program" is. What you posted would not fit my definition of "program", but it is a Java class that can be executed without having a main method, yet still executes some code.
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic