Scanner input = new scanner();
String code = input.next();
错误写法://String code = input.toString();
1、输入字符串 遇到空格或者换行结束
Scanner sc=new Scanner(System.in);
String str=new String();
str=sc.next();
2、输入一行字符串,可以包括空格
Scanner sc=new Scanner(System.in);
String str=new String();
str=sc.nextLine();