📜  如何在 Java 代码示例中使用扫描仪类

📅  最后修改于: 2022-03-11 14:52:39.639000             🧑  作者: Mango

代码示例3
// import Scanner
import java.util.Scanner;

// Initialize Scanner
Scanner input = new Scanner(System.in);

// Test program with Scanner
System.out.println("What is your name?");
String name = input.nextLine();

System.out.println("Hello," + name + " , it is nice to meet you!");