Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 2
    Why not use String.split()? StringTokenizer is a legacy class. Commented Feb 2, 2017 at 11:38
  • thanks a lot, I will try with String.split() Commented Feb 2, 2017 at 11:44
  • it did not solve my problem, I can only choose how many of them I want to "print out ", but I still cant choose which one. Commented Feb 2, 2017 at 11:55
  • There is no law that says you have to use a loop. You can just use several if statements one after the other to check if there is still a token and get the next token and do something with it. Commented Feb 2, 2017 at 11:56
  • thanks @RealSkeptic, Commented Feb 2, 2017 at 12:05