Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java question



Thomas O'Dowd wrote:

> use a loop with an exit condition, or an infinite loop with a break, or ...
>
> int someInt;
> while()
> {
>         try
>         {
>                 someInt = Integer.parseInt(readUserInput());
>                 if(someInt >= 1 && someInt <= 10)
>                         break;
>         }
>         catch (NumberFormatException)
>         {
>                 ;
>         }
> }
>

This is how I started doing it initially, but if I used somInt after the catch
statement javac said: cannot resolve symbol. The "finally" statement solved
it.

Thanks to all who replied!

--
B0Ti.

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links