我的循环从未停止,我似乎无法理解错误。我正在为我的课程做一个项目 ,我对新的循环感到困惑。请告诉我如何 来解决这个问题。为什么我的“While”循环继续进行?
import java.util.Scanner;
public class FracCalc {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in); {
boolean Quit = true;
System.out.println("Welcome to FracCalc");
System.out.println("Type expressions with fractions, and I will evaluate them");
String answer = scan.nextLine();
while (Quit = true) {
if (answer.equals("Quit")){
System.out.println("Thanks forr running FracCalc!");
break;
} else {
System.out.println("I can only process 'Quit' for now");
}
}
}
}
}
你永远设置为“退出”,以虚假的变量。 – lzcd 2014-10-28 02:05:24