Solved

try and catch ...

Posted on 2006-06-14
3
208 Views
Last Modified: 2010-03-31
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 {
     }

  }
0
Comment
Question by:meow00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 92

Expert Comment

by:objects
ID: 16907522
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
 
LVL 1

Author Comment

by:meow00
ID: 16907539
so ...  it is legal to have nested try-catch ???
0
 
LVL 92

Accepted Solution

by:
objects earned 350 total points
ID: 16907551
yes
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question