当打开到System.in的两个管道,然后关闭一个管道时,为什么nextLine会导致nosuchelementexception?

问题描述

打开两个通往nextLine()的管道,然后关闭一个管道,为什么NoSuchElementException会导致System.in

String input = "";
Scanner sc = new Scanner(System.in);
Scanner sc1 = new Scanner(System.in);
 
input += sc.nextLine() + " ";
input += sc.nextLine() + " ";
 
sc.close();
System.out.println(input);
 
sc1.nextLine()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)