こんにちは、ユーザーにいくつかの値を入力するように求めるメソッドを書いています。これらの値を保存し、配列をプログラムに返したいと思います。これは私が書いたコードです
public static int[] readInQuarters(String[] firstName, String[] lastName)
{//method to read in quarters
int[] quarter1= new int[firstName.length];
int[] quarter2= new int[firstName.length];
int[] quarter3= new int[firstName.length];
int[] quarter4= new int[firstName.length];
Scanner input=new Scanner(System.in);
for(int i=0;i<firstName.length;i++){
System.out.printf("Enter the 1st quarter figure(to the nearest million) for %s %s :",firstName[i], lastName[i]);
quarter1[i]= input.nextInt();
}
for(int i=0;i<firstName.length;i++){
System.out.printf("Enter the 1st quarter figure(to the nearest million) for %s %s :",firstName[i], lastName[i]);
quarter1[i]= input.nextInt();
}
for(int i=0;i<firstName.length;i++){
System.out.printf("Enter the 2nd quarter figure(to the nearest million) for %s %s :",firstName[i], lastName[i]);
quarter2[i]= input.nextInt();
}
for(int i=0;i<firstName.length;i++){
System.out.printf("Enter the 3rd quarter figure(to the nearest million) for %s %s :",firstName[i], lastName[i]);
quarter3[i]= input.nextInt();
}
for(int i=0;i<firstName.length;i++){
System.out.printf("Enter the 4th quarter figure(to the nearest million) for %s %s :",firstName[i], lastName[i]);
quarter4[i]= input.nextInt();
}
return quarter1;
return quarter2;
return quarter3;
return quarter4;
}
return Quarter1 とその他は unreachable ステートメント エラーであることがわかります。私はなぜ混乱しているのですか?