键盘录入

  顺序 package>import>class

 1 package com.test;
 2 
 3 import java.util.Scanner;
 4 
 5 public class ScannerTest{
 6     public static viod main(String[] args){
 7         //先创建Scanner对象
 8         Scanner sc = new Scanner(System.in);
 9         
10         //接收数据
11         int a = sc.nextInt();
12         
13         //打印数据
14         System.out.println(a);
15     }
16 }

猜你喜欢

转载自www.cnblogs.com/yifengs/p/10667277.html