Originally posted by Martin Simons:
...I believe the JVM will only be able to execute the main method from the public class making the main method in the other class irrelevant.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Originally posted by Emanuel Kadziela:
...It is however, one of, if not THE, most unadvised thing(s) to do according to the java coding conventions.
You can create a main( ) for each one of your classes, and it's often recommended to code this way so that your test code is wrapped in with the class. Even if you have a lot of classes in a program, only the main( ) for the class invoked on the command line will be called. (As long as main( ) is public, it doesn't matter whether the class that it's part of is public.) ... This technique of putting a main( ) in each class allows easy unit testing for each class. And you don�t need to remove the main( ) when you�re finished testing; you can leave it in for later testing.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
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 Stan James:
Let's back up and see if we got the question right.
First, you can only put one top level class in each file. [/CODE]
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
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
machines help you to do more, but experience less. Experience this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|