解决办法是:在main函数中测试方可有效。

public static void main(String[] args){

 Scanner sc = new Scanner(System.in);
//接收数据
System.out.println("请输入一个字符串数据:");
String s = sc.nextLine();
//输出结果
System.out.println("s:"+s);

}

相关文章:

  • 2022-12-23
  • 2021-09-16
  • 2021-08-26
  • 2021-04-30
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
猜你喜欢
  • 2021-06-01
  • 2021-08-07
  • 2021-09-14
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
相关资源
相似解决方案