I want to ask the user for input in console. He'll be writing down two numbers separated by a single space.
In Java is there something like the C# Split() method I can use?
Thank you!
I want to ask the user for input in console. He'll be writing down two numbers separated by a single space.
In Java is there something like the C# Split() method I can use?
Thank you!
Yes, there is: String.split. Note that it takes a regex as the parameter though. Alternatively you could use a StringTokenizer
or a Scanner
.