以下内容是什么意思?eclipse中无法访问的代码
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();
}
}
我想了解此错误消息。 在此先感谢。
护理共享代码。 –
代码无法访问;这意味着你可能在无限循环之后有一个声明。 –
@JoshM。不必要。还可能有其他情况。 –