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*

13
  • 8
    Actually its taking more than one character, but acting only on the first character Commented Dec 19, 2012 at 2:39
  • 3
    @user1804697 to consume just characters use char c = reader.next("[a-zA-Z]").charAt(0); Commented Apr 15, 2014 at 21:10
  • 20
    What's the difference between "exactly" and "strictly" in this context? Commented Nov 29, 2017 at 18:02
  • 2
    @Reimeus what exactly is the value in copy pasting code and then running it? Commented Jun 7, 2018 at 17:37
  • 3
    Well, the next() version crashes on the gibberish input bhjgfbergq35987t%$#%$# and the findInLine() version doesn't. My question was really more about the words "strictly" and "exactly" and not the corresponding code fragments. I'm unaware of a context in which those words are not synonyms. Commented Jan 4, 2019 at 13:50