错误: javac FreshJuice.java FreshJuice.java:6:错误:类FreshJuiceTest是public,应该在名为FreshJuiceTest.java的文件中声明 公共类FreshJuiceTest { ^ 1错误
class FreshJuice {
enum FreshJuiceSize{ SMALL, MEDIUM, LARGE }
FreshJuiceSize size;
}
public class FreshJuiceTest {
public static void main(String args[]) {
FreshJuice juice = new FreshJuice();
juice.size = FreshJuice.FreshJuiceSize.MEDIUM;
System.out.println("Size: " + juice.size);
}
}
答案 0 :(得分:4)
Java文件中只能包含1个公共类。该公共类的名称必须与文件名相同。
文件selector
应包含可能公开或不公开的类handleDismiss
。但不得包含带有任何其他名称的 public 类。