1.导包:importjava.util.Scanner;2.创建键盘录入对象:Scanner sc =newScanner(System.in);3.通过对象获取数据:int a = sc.nextInt();