More Excptions

Reply

Join Date: Feb 2008
Posts: 28
Reputation: Parsu7 is an unknown quantity at this point 
Solved Threads: 1
Parsu7 Parsu7 is offline Offline
Light Poster

More Excptions

 
0
  #1
Feb 28th, 2008
I just want to know what happens when this code is written:
public static void main(String[] args) throws IOException
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 1,658
Reputation: javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all 
Solved Threads: 223
Featured Poster
javaAddict's Avatar
javaAddict javaAddict is offline Offline
Posting Virtuoso

Re: More Excptions

 
0
  #2
Feb 28th, 2008
You will not be obligated to write something like:
  1. try {
  2.  
  3. } catch(IOException io) {
  4.  
  5. }
in your code. Meaning that if a method throws an IOException you will not have to catch it but if it is thrown there will be no place for the exception to "go" since nothing calls main(), so the program will end with exception.
Check out my New Bike at my Public Profile at the "About Me" tab
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,438
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: 510
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: More Excptions

 
0
  #3
Feb 28th, 2008
And for that reason, you shouldn't ever throw exceptions from main().
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 28
Reputation: Parsu7 is an unknown quantity at this point 
Solved Threads: 1
Parsu7 Parsu7 is offline Offline
Light Poster

Re: More Excptions

 
0
  #4
Feb 29th, 2008
Thank you.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 28
Reputation: Parsu7 is an unknown quantity at this point 
Solved Threads: 1
Parsu7 Parsu7 is offline Offline
Light Poster

Re: More Excptions

 
0
  #5
Feb 29th, 2008
Originally Posted by javaAddict View Post
You will not be obligated to write something like:
  1. try {
  2.  
  3. } catch(IOException io) {
  4.  
  5. }
in your code. Meaning that if a method throws an IOException you will not have to catch it but if it is thrown there will be no place for the exception to "go" since nothing calls main(), so the program will end with exception.
Thank you.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC