Results 1 to 4 of 4
  1. #1
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    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
    13,020
    Blog Entries
    7
    Rep Power
    20

    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
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    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
    13,020
    Blog Entries
    7
    Rep Power
    20

    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
    cenosillicaphobia: the fear for an empty beer glass

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, 10: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, 09: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
  •