Results 1 to 4 of 4
  1. #1
    allaudin's Avatar
    allaudin is online now Senior Member
    Join Date
    Apr 2013
    Location
    Planet Earth
    Posts
    275
    Rep Power
    0

    Default Exception Handling Method

    Java Code:
    class Practise {
    
    	/**
    	 * @throws IOException
    	 */
    	public static void main(String[] args) throws IOException {
    		System.in.read();
    
    	}
    
    }
    Is this new method of exception handling in java 7 ?

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,315
    Blog Entries
    7
    Rep Power
    25

    Default Re: Exception Handling Method

    Quote Originally Posted by allaudin View Post
    Is this new method of exception handling in java 7 ?
    Nope, it has been there since Java 1.1.2 (or earlier); it marks the method to (possibly) thrown an IOException.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    allaudin's Avatar
    allaudin is online now Senior Member
    Join Date
    Apr 2013
    Location
    Planet Earth
    Posts
    275
    Rep Power
    0

    Default Re: Exception Handling Method

    oh I saw this for the first time ... is it same as try-catch ?

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,315
    Blog Entries
    7
    Rep Power
    25

    Default Re: Exception Handling Method

    Start reading the API documentation of the Throwable class; the Exception class marks the checked exceptions and is a sub-class of the Throwable class. Checked exceptions need to be handled by your methods or marked in a 'throws' clause in the method signature. Almost nobody realizes that the Throwable class starts an entire hierarchy of (checked or unchecked) exceptions, that's one reason why so much code is a mess w.r.t. exception handling.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Exception Handling
    By teja in forum New To Java
    Replies: 6
    Last Post: 05-15-2013, 06:41 PM
  2. Exception Handling
    By teja in forum Java Certification
    Replies: 1
    Last Post: 05-15-2013, 12:47 PM
  3. Exception handling
    By Moedig in forum New To Java
    Replies: 2
    Last Post: 11-10-2011, 11:43 PM
  4. Handling Exception in run() method
    By anandkumar in forum New To Java
    Replies: 1
    Last Post: 05-27-2011, 06:44 PM
  5. Exception Handling help
    By MZA in forum New To Java
    Replies: 3
    Last Post: 02-10-2010, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •