1.The public type TestInfo2 must be defined in its own file
原因:一个文件的文件名必须于public class 的名字一样,不一样就报错。
解决方案:重命名,保持文件名于public 修饰的类名一致。
2.Scanner cannot be resolved to a type
原因:扫描器无法解析为一个类型,没有加类型
解决方案:按照下面解决方案进行添加
3.Type mismatch: cannot convert from Scanner to double/int
原因:类型不匹配:无法从扫描器转换为双倍转换。
解决方案:前面什么数据类型,后面跟.nextXXXX()。
4.The method method2(int) in the type TestMethod is not applicable for the arguments ()
原因:类型Test方法中的方法方法2(int)不适用于参数()
调用方法时,没有传参数,一个是method2(),一个是method2(int),参数类型不匹配
解决方案:在()里添加数值。或者删掉方法定义中的参数
5.Test cannot be resolved to a type
原因:测试无法解析为一个类型
解决方案:导入给出的解决方案包,可以选择版本高的
6.数组下标越界
原因: java.lang.ArrayIndexOutOfBoundsException:数组下标越界异常,因为访问了不存在的下标。
解决方案:按照提示删除多余数组
7.The field Student.name is not visible
原因:字段学生区。名称不可见,name字段被private封装。
解决方案:注释或者去掉private
8. The method toString(long[]) in the type Arrays is not applicable for the arguments (void)
原因:类型数组中的转到String(长[])的方法不适用于参数(void)
解决方案:sort方法没有返回值,不可以这样写,他是排序。如注释是正确的。
9. The abstract method game in type Zia can only be defined by an abstract class
原因:Zia类型中的抽象方法只能由一个抽象类来定义。
解决方案:父类中定义过抽象方法,子类要么重写要么不能出现。