This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm trying to decipher your "java application" answer. I've seen it on Eclipse. Are you using Eclipse? Or any other IDE like NetBeans, IDEA, JBuilder, else? What your java application will do? If it's a program that will execute stand alone then you need only one starting point so only one main method.
Can you write a whole paragraph describing exactly what you're asking? Methods don't belong to projects; they belong to classes. A class can have any number of methods, but only one "main". A project is just an arbitrary collection of classes, and so it can have any number of "main" methods.
Before the days of unit testing tools like JUnit, lots of people wrote a main() in classes to run a few tests or examples. So they might have many, many classes with main methods. There is probably usually just one or very few that are really meant to start up the whole application.
It can get more complex as you reuse components and customize applications. I took a program that already had a main() and wrote another class to set up the environment and configure some things before calling the original main. So now it has two that do slightly different things.
Is that answering the right question?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by corey williams: i'm sorry i didn't mean methods, i meant main class, how mian classes can you have in a project
As many as you like... If you start a Java program, you have to specify the class that contains the main method to the JVM. You can put any number of classes that contain a main method in your project. When you run the program, you'll just have to specify which one you want to use.