The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
May 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


trouble with try-catch...

Posted by Steve on May 28, 2000 at 11:56 PM

I entered a simple program because it uses a try and catch
statement and I have no experience with the two. Here's the code
as seen in the book. It throws two errors and I cannot find the
answer. Give a holler if you see anything wrong with the code.

Thanks, Steve:

public class Fruit
public static void main(String[] args)
int numOranges = 5;
int numApples = 10;
int numFruit = 0;

numFruit = numOranges + numApples;

System.out.println("A totally fruity program.");
System.out.println("Total fruit is " + numFruit);

System.out.println("(press ENTER to exit)");
catch (IOException e)


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us