class="java" name="code"> import java.util.Scanner; public class ScannerTest { public static void main(String[] args) { testScanner(); } public static void testScanner(){ Scanner s = new Scanner(System.in); System.out.println("请输入内容:"); String str = s.next(); System.out.println("您输入的是:" + str); s.close(); } }