私はJavaプログラミングが初めてです。配列にキーボードからの整数を入力できる方法があるかどうかを知りたいです (範囲: 10 から 65)。これが私のコードです:
public static void main(String[] args)
{
//Keyboard Initialization
Scanner kbin = new Scanner(System.in);
//a.Declare an array to hold 10 intgers values
int list[]=new int[10];
int i=0;
//b.Fill the array with intgers from the keyboard(range: 10 to 50).
System.out.print("\n\tInput numbers from 10 to 50: \n");
list[i]= kbin.nextInt();
if(10<=list[i] && list[i] <= 50)
{
for(i=1; i<=9;i++)
{
list [i] = kbin.nextInt();
}
}
}
助けてください。ありがとう!