public class Test9 //在这里收到错误 { public static void run() { System.out.println(运行中); } public static void fly() { System.out.println(飞行中); } } 公共类GoodDeveloper { public static void main(String [] args){ Test9.run( ); Test9.fly(); } } 我尝试了什么: 在上面的注释行我我得到的错误如公共类型Test9必须在其自己的文件中定义。请建议此错误的含义(但我知道解决方案。即删除公众) 请告诉我为什么我不能将我的课程设为公共
public class Test9 // getting error here { public static void run() { System.out.println("In run"); } public static void fly() { System.out.println("In fly"); } } public class GoodDeveloper { public static void main(String[] args) { Test9.run(); Test9.fly(); } } What I have tried: in the above commented line I am getting error like "the public type Test9 must be defined in its own file. Please suggest the meaning of this error( however i know the solution. i.e. removing public) Please tell me why I cannot make my class as public
推荐答案你在同一个源文件中定义了多个公共类。不允许的。 / ravi You've defined more than one public class in the same source file. Java doesn't permit that. /ravi
更多推荐
请提供以下错误的含义
发布评论