This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You would have had both the classes defined in the same java file named StaticTest.java.Here in StaticTest.java has one public class StaticTest and one default class Static. After compilation two class files will be generated StaticTest.class and Static.class. And now you would have run the below cmd java StaticTest This will result in the exception , because the class StaticTest does not have the main method.
Fix would be do swap the access modifiers of the classes and rename the class to Static.java OR java Static will give the desired result. This will now look for the main() in Static.class and will find and execute it.