read() returns a single character. Simplifying a bit, the returned value is the Unicode value for the character, which (for the US/English locale) is the same as the ASCII code. ASCII maps characters onto numbers. The digits 0, 1, 2... are 48, 49, 50... decimal. Since these are all less than 100, you're always going to get "OK". Try typing a lower-case letter "z" -- the code for that is over 100, and so you won't see the "OK".
You need to translate characters into numbers. Read this to start learning the right way to do it.
There are static methods in either String, Integer or Double or something that do the reqired translation, and can handle input strings longer than one chararcter. This is called parse/parsing in computer terminology.
There's one from the Integer class. Every time I begin this problem, I have to look it up. That is what the experienced people do, look it up almost eveery time.
It is a normal problem, but real soon you will get lost in all the information. Just keep coding, compiling and fixing.
"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
Joined: Sep 17, 2006
If you want to have some beginner fun, look at that one that says:
parseInt("Kona", 27) returns 411787 [ September 22, 2007: Message edited by: Nicholas Jordan ]
Joined: Aug 12, 2004
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com