The following program compiled fine and there are no runtime errors too. But it is not working the way I want. Can anyone please help.
When I enter input value as '1', it is displaying the output "ONE" as expected. When I enter any other value, nothing happens.
Is there a rule that JOptionPane showInputDialog method should be used for showMessageDialog to work ?
If I use JOptionPane showInputDialog method instead of InputStreamReader readLine method to get the input, the program starts working fine.
I am not sure why the program is not working properly if I use InputStreamReader readLine method for getting input and JOptionPane showMessageDialog method for displaying output.
It works all right for me.
Beware of these dialogue windows. They can appear behind other things on the screen, and you might need to minimise other windows before you see the dialogues.
Joined: Sep 08, 2004
I tried both in Eclipse and Netbeans. The issue persists. When I enter input other than 1, output is expected in JOptionPane Message Dialog box but nothing is displayed. Not sure if it is an issue with JDK 7.