-1
我的程序沒有結束。我是初學者,無法理解爲什麼。在我更改名稱之前它工作正常,所以我將它複製到另一個文件,但仍然沒有結束。我的程序沒有結束
import java.util.Scanner;
public class Fan
{
public static void main (String[] args)
{
Scanner s = new Scanner(System.in);
//first input
System.out.println("Enter your first input: ");
String first = s.nextLine();
String[] firstsplit = first.split(", ");
//second input
System.out.println("Enter your second input: ");
String second = s.nextLine();
String[] secondsplit = second.split(", ");
//third input
System.out.println("Enter your third input: ");
String third = s.nextLine();
String[] thirdsplit = third.split(", ");
//fourth input
System.out.println("Enter your fourth input: ");
String fourth = s.nextLine();
String[] fourthsplit = fourth.split(", ");
//fifth input
System.out.println("Enter your fifth input: ");
String fifth = s.nextLine();
String[] fifthsplit = fifth.split(", ");
for (int a = 0; a<=firstsplit.length-1; a++)
{
//skipping over values that say how many pieces are on board
for (int i = 3; i <= 12; i++)
{
//compatible with piece numbers up to 12(max)
if (Integer.parseInt(firstsplit[0])==i) {
while (i >= 1 && i <= Integer.parseInt(firstsplit[i])) {
continue;
}
System.out.println(firstsplit[i]);
}
}
}
}
}
我將不勝感激任何意見。
您確定'while(i> = 1 && i <= Integer.parseInt(firstsplit [i]))'對於您所有的輸入條件實際上都會計算爲false嗎? – aruisdante