scanner2

package li;

import java.util.Scanner;

public class Demo2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("使用nextLine方式接受");

    if (scanner.hasNextLine()){
        String str = scanner.nextLine();
        System.out.println("输出的内容为:"+str);
    }

    scanner.close();
}

}

posted @ 2021-10-19 14:41  xxm555  阅读(22)  评论(0编辑  收藏  举报