1.变量可能未初始化
错误提示:Abc.java:9: variable i might not have been initialized
2.变量重复定义
错误提示:Abc.java:9: i is already defined in main(java.lang.String[])
3. 找不到符号:
Test6.java:26: cannot find symbol
4. 找不到类的错误
Main.java:4: cannot find symbol
5. 找不到方法的错误
Main.java:5: cannot find symbol
6. 找不到类
错误提示 Test.java:1: class Test1 is public, should be declared in a file named Test1.java
public class Test1 {undefined
建一个文件为Test;在工具中打开这样写 public class Test11 {}; 就会报这个错误
NoClassDefFoundError: asa (wrong name: ASA)
8. 数组下标越界
java.lang.ArrayIndexOutOfBoundsException: 1
at Test2.test2(Test2.java:30)
at Test2.main(Test2.java:6)
9. 字符串下标越界
java.lang.StringIndexOutOfBoundsException: String index out of range: 6
at java.lang.String.charAt(String.java:558)
at Test2.test3(Test2.java:41)
at Test2.main(Test2.java:7)
10. 空指向
Exception in thread "main" java.lang.NullPointerException
at Next.main(Next.java:31)
错误提示 Test1.java:54: 'void' type not allowed here
System.out.println(a5.deleteOnExit());
例子说明 如果声明一个void的方法,那就不能直接输出来
Public static void edit() {}
System.out.println(Test.edit());
asa.java:8: missing return statement
asa.java:10: cannot return a value from method whose result type is void
14. 引用的方法入参不对
Next.java:66: cannot find symbol
symbol : method createTempFile(java.lang.String,java.lang.String,java.lang.String)
location: class java.io.File
File ll = f.createTempFile("let","java","aaa");
15. .缺少形参
del() in sms.service.Service cannot be applied to (int)
invalid method declaration; return type required
public byteValue(){undefined
17. 要求传入的是数组,却传入了字符串
array required, but java.lang.String found
Main.java:4: cannot find symbol
19、数字格式化异常
Exception in thread "main" java.lang.NumberFormatException: null 20. .不兼容的类型
错误提示Test1.java:41: incompatible types
found : java.lang.String[]
21. 非静态方法不能在静态上下文中引用
non-static method cannot be referenced from a static context
22.不是静态方法而用静态方式调用(类名。方法)
Main.java:5: non-static method fun1() cannot be referenced from a static context
Test.java:5: non-static variable a cannot be referenced from a static context
24. 静态访问非静态(方法)
Test.java:6: non-static method fun1() cannot be referenced from a static context
25.continue outside of loop (将continue放在for循环外的时候出现的错误报告)
26.illegal start of expression 违反规则的表达(将for循环中第二表达放置于for循环外或内部时出现的错误报告)
27 asa.java:6: unreachable statement 不能到达的语句(语句放于continue或break后出
现不能到达,及continue和break后不能有语句)
asa.java:8: break outside switch or loop
30. 没找到方法体,或声明为抽象的(方法)
MyAbstract.java:6: missing method body, or declare abstract
31. 这个类不是抽象类 或者没有覆盖 重写方法fun1() 有抽象的方法的就必须是抽象类
MyAbstract.java:1: MyAdstract is not abstract and does not override abstract method fun1() in MyAdstract
32. Myabstract 它是属于抽象类的,不能产生对象。
3.Main.java:6: Myabstract is abstract; cannot be instantiated
33. 接口的方法不能有方法体
4 MyInterface.java:2: interface methods cannot have body
Myabstract is abstract; cannot be instantiated
35. 接口的方法不能有方法体
interface methods cannot have body
36. 此处不允许使用static修饰
asa.java:3: modifier static not allowed here
public static void main(String []args){undefined
37—不能改变的类型(String 型 不能转换成Int型)
asa.java:4: inconvertible types
38.possible loss of precision found: long ;required:byte ; var=varlong 可能造成精度损失(在整型较大的转换成较小的情况下会造成损失,小的转大的,则不会造成损失。)
41. 应用程序试图创建大小为负的数组。
java.lang.NegativeArraySizeException
42. 出现异常的运算条件
java.lang.ArithmeticException: / by zero
at Test2.test(Test2.java:16)
at Test2.main(Test2.java:5)
43抽象方法不能被final修饰(抽象类的抽象的东西一定要被继承)
44.抽象方法不能被private修饰(抽象类抽象的东西一定要被继承)
45 Integer number too large 定义值(整数)过大