If I copy and paste into a program It only takes the first line for instance I copy a few blocks from Microsoft Excel and Paste it pastes the codes like this:
72LYY-785B9-0WQD9
88CXK-4E8BB-TA2GD
JLEIZ-0KYKP-PY2E4
LV5TL-A6CLB-P59GX
My program only takes 72LYY-785B9-0WQD9
, but I want the scanner to take all until it is empty.
I am using
String userData = takeInput.nextLine();
I put it into a String and then turn it into an array of chars.
Any help?
Did you try any other approach?
Scanner stdin = new Scanner(new BufferedInputStream(System.in));
while (stdin.hasNext()) {
System.out.println(stdin.nextLine());
}
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.