Sacnner类
package com.tiedandan.base;
import java.util.Scanner;
public class Scanneruse {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("使用next方式接收");
//判断用户有没有输入字符串
if(scanner.hasNext()){
String str = scanner.next();
System.out.println("输出的内容为:"+str);
}
//io流即输入输出流用完记得关闭,否则一直占用资源
scanner.close();
}
}
https://www.bilibili.com/video/BV12J41137hu?p=33