Results 1 to 7 of 7
Thread: get exception name
- 06-05-2008, 01:58 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 39
- Rep Power
- 0
- 06-05-2008, 02:09 PM #2
Member
- Join Date
- Jun 2008
- Posts
- 43
- Rep Power
- 0
Do you mean the class of the Exception? If you do then I can help a little, if you actually mean 'Name' then I don't know!
This will get you the class of the Exception that was thrown, the output is:Java Code:try { if(true) { System.out.println("throwing exception"); throw new ArrayIndexOutOfBoundsException("Example"); } } catch (Exception e) { System.out.println("class = " + e.getClass().toString()); }
init:
deps-jar:
compile-single:
run-single:
throwing exception
class = class java.lang.ArrayIndexOutOfBoundsException
BUILD SUCCESSFUL (total time: 0 seconds)
- 06-05-2008, 02:09 PM #3
I am confused as to what you want here.
ArrayIndexOutOfBoundsException
Is the name of the exception.Did this post help you? Please
me! :cool:
- 06-05-2008, 02:12 PM #4
Member
- Join Date
- Jun 2008
- Posts
- 39
- Rep Power
- 0
s exactly i have to get a class of the exception......... help me.....
- 06-05-2008, 02:15 PM #5
What pao posted should help you.
ArrayIndexOutOfBoundsException (Java 2 Platform SE v1.4.2)Did this post help you? Please
me! :cool:
- 06-05-2008, 02:20 PM #6
Member
- Join Date
- Jun 2008
- Posts
- 39
- Rep Power
- 0
thank q friends i got the result.........
- 06-05-2008, 02:29 PM #7
Member
- Join Date
- Jun 2008
- Posts
- 2
- Rep Power
- 0
ArrayIndexOutOfBoundsException is itself only the class name of that exception.
i think you are passing values through command line in the program "exec".
if so , do like this
ex,,
Public static void main(String s[])
{
try{
write your code here,,,,,
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println(e);
}
}// end of main
i hope it works,,,,
Regards
Vinay TJ
Similar Threads
-
exception
By thamizhisai in forum Advanced JavaReplies: 9Last Post: 05-30-2008, 08:47 AM -
Exception
By rmaadil in forum JDBCReplies: 1Last Post: 05-19-2008, 12:45 PM -
Exception!
By rameshraj in forum Advanced JavaReplies: 1Last Post: 05-05-2008, 01:39 PM -
exception
By Oktam in forum New To JavaReplies: 2Last Post: 03-23-2008, 07:01 PM -
Trouble with factory method - unhandled exception type Exception
By desmond5 in forum New To JavaReplies: 1Last Post: 03-08-2008, 06:41 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks