1、获取键盘输入首先创建一个对象 Scanner sc = new Scanner(System.in),然后利用一个变量 int a = sc.nextInt();就可以获取了
2、随机数生成的方法Random r = new Random(9);实际范围是0-8