2020-06-26【Scanner:数据输入】
2020-06-26 本文已影响0人
skillplus
image.png
package com.scanner;
import java.util.Scanner;
/**
* 数据输入
* 导包
* import java.util.Scanner
* 创建对象
* Scanner sc = new Scanner(System.in);
* 接收数据
* int x = sc.nextInt();
*/
public class ScannerDemo {
public static void main(String[] args) {
//创建对象
Scanner sc = new Scanner(System.in);
//接收数据
int x = sc.nextInt();
//输出数据
System.out.println(x);
}
}