This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi! Am very new at java (only been doing if, while and so on. No idea of arrays, bufferstrings etc! Presently using consolewindow for input) and my problem is this: Basically, when I ask the user for a int or a double input and he/she enters a char, then the whole thing hangs; ideally, if the user does that, I'd like the question to be repeated. eg: c.out.println("Please enter number needed") ; num = c.input.readInt () ; I've been able to block sort the other way round, in that the program will loop back to the question should the user enter an int instead of a char by: if (!(word == 'h') || word == 'r') and then putting another c.out.println and readString etc underneath. For my problem I've tried doing whiles and ifs based on (!(num >= 0) %% num <= 0) but within a while statement, all I get is a just a mess! Is there a simple way to solve this using whiles and ifs? Thanks! Robin [ March 19, 2004: Message edited by: Jay Dobrzyn ]