當在未進入正確的選擇它不顯示重新進入或重複循環while循環沒有瓶坯else語句和重複循環
int counterA = 0;
while (counterA < 0) {
if (conversionSelection.equalsIgnoreCase("binary"))
counterA++;
if (conversionSelection.equalsIgnoreCase("octal"))
counterA++;
else System.out.println("Error. Please enter weither to convert the Hex to Octal or Binary:");
conversionSelection = keyboard.nextLine();
}
謝謝......我原來寫的代碼有其他if語句,但一直寫爲「如果別人」並且不可能搞清楚爲什麼它不工作。 – jscincy1 2014-10-17 00:17:02