Make multiple Classes in one file
File name MUST BE MATCHED WITH Class name which includes main method
If thereis public class, the filename must be matched with public class name!
Hello2.java
If there is no public class, source file name doesn't matter either 'Hello2.java' or 'Hello3.java'
2. In one source file, there musn't be more than one. Separate class to different source file or remove public from one of them.
Hello2.java
3. Uppercase and lowercase does matter even in name. Uppercase in filename, Uppercase in class name as well!
hello2.java
Recommend one Class in one source file.
If source file name and Class name does not match(including Upper/Lower case), it never execute what you want! It just execute randomly.
Control Manually
Run>Run Configuration or Right click on source view>Run As>Run Configuration>Main class: correct the class name to what you want to run. or click "search" button.
Last updated