basically i need to ask the user if they wanna change dimensions of silo 1 and then silo 2.. but i want to put in an exception to catch any numbers, or other characters that arent letters... which exception would i use?
Add some new lines so as to fit all code into width of screen. CR.[/edit]
I presume you have already initialised num to -1? In which case NumberFormatException looks correct.
But those multiple if-elses don't. Imagine how complicated that would look if you had a silo3 or a silo4. Is there any way of passing a reference to the silo to change, so you can call
I am not happy to see a System.exit() call. That is probably safe in this instance, but if you have a larger application, you might interfere with other processes going on, and have something disastrous like a file half-written and not properly closed.
There are other dialogs available in JOptionPane; there is one which can return YES/NO, which would probably fit your purposes better than input dialog for getting YES/NO.