1.数据输入
1.2 Scanner使用的基本步骤
(1)导包
import java.util.Scanner;
(2)创建对象
Scanner sc = new Scanner(System.in);
(3)接受数据
int i = sc.nextInt();
1.3 实例
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); System.out.println("x:"+x); } }
结果:
标签:Java,Scanner,int,System,003,nextInt,sc,输入 From: https://www.cnblogs.com/yiqiesuifeng/p/17688564.html