我是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();
}
}
}
请帮忙。谢谢!