View Single Post
Join Date: May 2007
Posts: 4,515
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 523
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Else If statement

 
0
  #10
Sep 7th, 2007
Originally Posted by thenava View Post
or just add

throws IOException

underneath your main method declaration.

...
public static void main(String args[])
throws IOException {
String name;
...


that should work.
No, main really should not throw exceptions. How do you intend to handle an exception that is thrown beyond the scope of your execution?

The catch block should be placed within main() and handle the exception gracefully.
Reply With Quote