"至少有两个方法1. Scanner sc=new Scanner(System.in); String s=sc.next(); 2. Scanner in = new Scanner(System.in);String s = in.nextLine();"