美文网首页
2020-06-26【Scanner:数据输入】

2020-06-26【Scanner:数据输入】

作者: skillplus | 来源:发表于2020-06-26 10:42 被阅读0次
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);
    }
}

相关文章

网友评论

      本文标题:2020-06-26【Scanner:数据输入】

      本文链接:https://www.haomeiwen.com/subject/zevyfktx.html