开发者

How can I get two numbers that are written in a single line - is there a Split() method?

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.


There is a split() method in String class.

String.split();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜