try and catch ...

Hello experts,

   I failed to put try catch for the IOEXCEPTION for in.readLine ... because I already have a tray-catch inside the while loop ... is there a way to solve this problem ? thanks.


  while ((str = in.readLine()) != null) {
     try {
     } catch {
     }

  }
LVL 1
meow00Asked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
yes
0
 
objectsCommented:
its the readLine() method that throws the exception so the try catch needs to go around that line

  try {

   while ((str = in.readLine()) != null) {
       try {
       } catch (Exception ex) {
       }
    }

   } catch (IOException ex) {
       ex.printStackTrace();
   }
0
 
meow00Author Commented:
so ...  it is legal to have nested try-catch ???
0
All Courses

From novice to tech pro — start learning today.