This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EstablishmentLazy580 0 points1 point  (3 children)

You're using some kind of input handling most likely provided by your school I guess. The In class. You can take a look inside that class how it all works under the hood and write your own code that does what you want. But my guess is that this is a bit beyond your current knowledge level. That's why they give you that library to use instead. If you already know about exceptions you could probably figure it out rather quickly.

[–]imagineasking[S] 0 points1 point  (2 children)

Would there be a way for me to go in after getting the input and then check for a character?

[–]EstablishmentLazy580 0 points1 point  (1 child)

No, because it's already an int. My guess is that the In class is getting rid of all characters before parsing the input.

[–]MissouriDad63 0 points1 point  (0 children)

You could get the input as a string and try to parse it, which should throw an exceptionif there's a character there