![image](https://i-blog.csdnimg.cn/blog_migrate/5a9ed808d959fed0dd795c246e48624f.png)
一.main方法接受参数
了解即可
二.Console
了解即可
public class ConsoleDemo {
public static void main(String[] args) {
Console console = System.console();//获取Console对象
String s = console.readLine();//从控制台读取一行
System.out.println(s);
}
}
三.Scanner类
新建Scanner.java
public class ScannerDemo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
System.out.println(s);
}
}