prelab10 - catch block. try{ bright.turnOnLed(); } Catch(

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab #10 Pre-lab Name ___________________________________ 1. Take a look at the tekpet API which is here: http://web.engr.oregonstate.edu/~goskab/javadoc/ What exception can be thrown by turnOnLed() (in the Led class)? NotConnectedExceptio n 2. Assume you have an Led object named bright. Write a try block that contains bright calling its turnOnLed() method. And then write a catch block that catches the exception you mentioned above. Put a print statement inside your
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: catch block. try{ bright.turnOnLed(); } Catch( NotConnectedExceptio n){ System.out.println("You are not connected"); } 3. What exception is thrown by the parseInt method in the Integer class? NumberFormatException 4. What exception is thrown by the write method of the OutputStream class? IOException 5. What exception is thrown by the add(int, Object) method of the ArrayList class? IndexOutOfBoundsException...
View Full Document

This note was uploaded on 10/19/2010 for the course CS 161 taught by Professor Wallace during the Fall '08 term at Oregon State.

Ask a homework question - tutors are online