Results 1 to 7 of 7
Thread: Exception problem !!
- 02-20-2011, 01:40 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 27
- Rep Power
- 0
Exception problem !!
class Test{
public static void main(String args[]) throws Exception{
try{
throw new Exception();
}
finally{
System.out.println("No Error");
}
}
}
Please help me to understand this simple program..
I've no idea about throw new Exception(); line
I need to know what is happing there plus what is different between throw and throws
Thanks
- 02-20-2011, 01:43 PM #2
Member
- Join Date
- Feb 2011
- Posts
- 27
- Rep Power
- 0
thorws is ok, we declare we are not going to handle that excpetion!!
Can we use throw new Exception(); other than try block???
- 02-20-2011, 01:46 PM #3
- 02-20-2011, 01:56 PM #4
Member
- Join Date
- Feb 2011
- Posts
- 27
- Rep Power
- 0
Thank you for your reply..
That site does not talk about different between throws and throw right!!
as far as i understood, throws with "s" means it says i'm not going to handle this excpetion,
Throw means creating exception object and handle it~!!
Pl;ease let me know, am i correct????
And, since new throw Exception to handle the excpetion, that is ONLY used in try block!! am i correct ??
Thanks you
- 02-20-2011, 01:59 PM #5
- 02-21-2011, 04:14 AM #6
This link might help you understand it more: How to Throw Exceptions
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 02-21-2011, 04:02 PM #7
Member
- Join Date
- Feb 2011
- Posts
- 27
- Rep Power
- 0
Similar Threads
-
Exception handling problem
By computerbum in forum New To JavaReplies: 2Last Post: 04-17-2010, 03:15 PM -
Exception-Based Problem
By Hax007 in forum New To JavaReplies: 2Last Post: 12-08-2009, 11:17 PM -
Problem using EBI Webservice getting Exception
By tealc76 in forum Advanced JavaReplies: 0Last Post: 11-21-2009, 06:20 PM -
Problem with null pointer exception?
By dunafrothint in forum AWT / SwingReplies: 3Last Post: 11-11-2009, 03:34 PM -
Problem with JSP exception handling page
By sidster in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 06-19-2008, 07:28 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks