So you can have multiple classes declared in a single java source file. but there can be only one public class in the file and the name of the file should be same as that of the public class followed by .java extension. Also note that the class having the
public static void main(String[] args) should be declared as public and rest of the rules mentioned before apply.
Jackson Thurston wrote:Thank you! But to run the test drive, what do I have to do? It obviously won't run on it's own since methods are within the other class. Would I have to put them in a .jar file?
Its enough to have the classes you are using in your classpath- Read the article-
HowToSetTheClasspath To know how to make use of the classpath.