Java Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP  Java Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java Application Hosting Web Hosting website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP,Python
Java Application Hosting Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP, Python Java Application Hosting Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, Python,JSP
Java Application Hosting Web Hosting Sign-Up Java Application Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting  Java Application Hosting Resellers web hosting, website hosting, web site hosting Java Application Hosting EZ Site Control Panel for web hosting,website hosting, web site hosting
Java Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python,JSP,  Fundraising
Java Application Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting
WWW.

Call Us Toll-Free
(877) 256-0328

Outside USA
1 - (201) 505-0430

Java Application Hosting Welcome Java Application Hosting Web Hosting Plans Overview , Fund Raising, Fundraising, web hosting, website hosting, web site hosting Java Application Hosting Fund Raising, Fundraising, web hosting Java Application Hosting Resellers, web Hosting Java Application Hosting Web Design, web Hosting Java Application Hosting Extra Services,  web Hosting Java Application Hosting Traffic Booster, web hosting Java Application Hosting Traffic Booster, web hosting Java Application Hosting Technical Support,  web Hosting Java Application Hosting webmaster tips,  web Hosting Java Application Hosting 30 Day Money Back, web hosting Java Application Hosting Legal Notices for Web Hosting Java Application Hosting Glossary Computer Terms for web Hosting Java Application Hosting Contact Information - web hosting

Site Map
Java Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python, JSP Java Application Hosting Java Application Hosting Java Application Hosting Java Application Hosting Java Application Hosting Questions and Exercises (The Java™ Tutorials > Essential Classes > Exceptions)
Trail: Essential Classes
Lesson: Exceptions
Home Page > Essential Classes > Exceptions
Questions and Exercises

Questions

  1. Is the following code legal?
    try {
        
    } finally {
        
    }
    
  2. What exception types can be caught by the following handler?
    catch (Exception e) {
         
    }
    
    What is wrong with using this type of exception handler?

  3. Is there anything wrong with the following exception handler as written? Will this code compile?
    try {
    
    } catch (Exception e) {
        
    } catch (ArithmeticException a) {
        
    }
    

  4. Match each situation in the first list with an item in the second list.
    1. int[] A;
      A[0] = 0;
    2. The JVM starts running your program, but the JVM can't find the Java platform classes. (The Java platform classes reside in classes.zip or rt.jar.)
    3. A program is reading a stream and reaches the end of stream marker.
    4. Before closing the stream and after reaching the end of stream marker, a program tries to read the stream again.

    1. __error
    2. __checked exception
    3. __compile error
    4. __no exception

Exercises

  1. Add a readList method to ListOfNumbers.java. This method should read in int values from a file, print each value, and append them to the end of the vector. You should catch all appropriate errors. You will also need a text file containing numbers to read in.

  2. Modify the following cat method so that it will compile.
    public static void cat(File file) {
        RandomAccessFile input = null;
        String line = null;
    
        try {
            input = new RandomAccessFile(file, "r");
            while ((line = input.readLine()) != null) {
                System.out.println(line);
            }
            return;
        } finally {
            if (input != null) {
                input.close();
            }
        }
    }
    
Check your answers.
Previous page: Summary
Next page: Basic I/O
 
 
 

Add to My Yahoo!

XML icon

Add to Google

 

 

 

 

 

 

 

 

 

 

 

JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP at JSP.aldenWEBhosting.com Servlets at servlets.aldenWEBhosting.com Tomcat at Tomcat.aldenWEBhosting.com mysql at mysql.aldenWEBhosting.com Java at Java.aldenWEBhosting.com Web Hosts Portal Web Links Web Links Web Hosting JSP Solutions Web Links JSP Solutions Web Hosting Servlets Solutions Web Links Servlets Solutions Web Hosting Web Links Web Links . . .
.
.
. .
.
. .
. . . . . . . . . . . jsp hosting servlets hosting web hosting web sites designed cheap web hosting web site hosting myspace web hosting