Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

try and catch ...

Posted on 2006-06-14
3
Medium Priority
?
210 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 1400 total points
ID: 16907551
yes
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

715 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