请提供以下错误的含义 [英] Please provide the meaning of below error

查看:95
本文介绍了请提供以下错误的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


这篇关于请提供以下错误的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆