基本上,我想创建一个程序来找到两个坐标的斜率。我已经这样做了,但是我希望程序询问它是否要重新启动——例如,找到一个不同的坡度,而用户不必退出并重新打开程序。这是我的代码,减去所有不必要的位:
import java.io.Console;
public class slopeFinder{
public static void main(String[] args) {
Console console = System.console();
do{
/* code to find slope here.
It asks for the X1, Y1, X2 and Y2 values using the readLine method on console
and then it parses the Strings and then does the math, obviously. Then it
prints out the slope. */
}
String cont = console.readLine(" Find another slope? Y/N ");
}
while (cont.equalsIgnoreCase("Y"));
}
}
我遇到的问题是我收到错误“找不到符号”的参考行
while(cont.equalsIgnoreCase("Y"));
我不明白我做错了什么?一切都拼写正确..