一:将键盘输入的数存到数组中,数组长度未知
public class Test{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String[] num = null; num = sc.nextLine().split(" "); int[] number = new int[num.length]; for(int i = 0; i < number.length; i++){ number[i] = Integer.valueOf(num[i]); } } }