以下是什么意思?
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Unreachable Code
at mycode.sample.main(sample.java:24)
我希望我能找到发生错误的行。我认为“24”是行,但我的项目中只有 23 行代码。
这是项目代码
package mycode;
import java.io.*;
public class sample {
int first;
int second;
public sample (int fir,int sec)
{
fir = first;
sec = second;
}
public void add()
{
System.out.println(first+second);
}
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int f = Integer.parseInt(reader.readLine());
// int s = Integer.parseInt(reader.r eadLine());
sample sample2 = new sample(f,100);
sample2.add();
}
}
我想了解此错误消息。提前致谢。