I am having troubles with java. I need to scan numbers (example: 1 3 4 2 5 6 7) and put them into array. The problem is I don’t know how long it will be. Is there a command that I can use to determine the length of the numbers putted in scanner?
I am having troubles with java. I need to scan numbers (example: 1 3
Share
If you don’t want to use ArrayList, as a workaround, I advice to read the entire line and then split to get the length and individual values:
EDIT: Second approach:
EDIT2: Taking care of multiple numbers in the same line and terminating at empty line