View Single Post
Join Date: May 2007
Posts: 4,363
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 501
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