What do you mean by "not reading properly"? You have to give us more to go on than that. What input are you giving it, and what results are you getting? Also, it's a good idea to wrap code in code tags, even when it's relatively simple code like this.
Joined: Jun 28, 2009
Thanks for the advice.
Here is the program. Please run it to see what i am telling is the problem
No one would able to help you till you tell the details. Even without running, I see that you code would not work, because you would get an error in the line 5 something like "Scanner cannot be resolved to a type". Is this your problem?
Misha is right on both counts. 1. You have to import java.util.Scanner for the program to compile, and 2. you have to explain what problems are having; you can't expect people who are helping you out of the goodness of their hearts to run your programs to figure out your problems for you.
That said, I ran your program anyway. With the addition of that missing import statement, it seems to run fine. What problem are you having?