How get string input from user using scanner
. eg:
Scanner get = new Scanner(System.in);
String name = get.nextString();
But calling doesn't work with string but it works with integers or double data types.
您必须使用new Scanner().nextLine()
或仅使用new Scanner().next()
因为Scanner
没有nextString()
方法。
您应该调用next()
方法而不是nextString()
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.