Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

throws IOException - 2 classes 1

Status
Not open for further replies.

listener22

Programmer
Jul 10, 2000
154
US
Hello -
I have a small app with 2 classes - one applet and one application.
The applet gets order information from the user, instantiates the
other class, passes some parameters to it, and then calls that other
object's methods to calculate the order cost. In an attempt to keep
the application class flexible, its default parameters are stored in
a file, rather than coded in as constants.
In order to read the file, "throws IOException" is included in the
set parameters method in the application class (there is no main method).
The application class compiles without error.
The applet class compile fails with a complaint that the
IOException is not caught or rethrown. However, the call to the
application object's set parameters method occurs in the applet's
init() method, and I haven't been able to successly place an IOException
phrase there.
Thanks in advance. Jim

oracle, vb
 
Jim,

> and then calls that other object's methods to calculate the order cost

place the call to 'calculate' in a try/catch block

try{
myObj.calculate();
}catch (IOException ioe){
System.out.println(ioe);
}

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top