Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2 objects EXCEPTION

 
Arun C. Giridharan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



ONly 1 exception is thrown out ....


output :
ArrayIndexOutOfBoundsException...MAIN()
End of main()


 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UseCodeTags the next time you post some code. I've also indented your code, because this is hardly readable.
And clearly tell what your problem is !
 
Arun C. Giridharan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Verré ! ...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain why you expect more than one exception ?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50244
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The throws declaration means it might throw an ArithmeticException or an ArrayIndexOutOfBoundsException, not both.

By the way: it is not usually necessary to declare unchecked Exceptions; those ought to be described with @throws tags in the documentation comments instead.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Giridharan wrote:
output :
ArrayIndexOutOfBoundsException...MAIN()
End of main()


The exception thrown in the finally block overruled the exception which thrown in the try block. Have a look on this link
 
Campbell Ritchie
Sheriff
Pie
Posts: 50244
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote:The exception thrown in the finally block . . .
What Exception in the finally block? I can see no Exception in the finally block.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
Abimaran Kugathasan wrote:The exception thrown in the finally block . . .
What Exception in the finally block? I can see no Exception in the finally block.


Is it?


Won't ArrayIndexOutOfBoundsException be thrown?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50244
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote: . . . Won't ArrayIndexOutOfBoundsException be thrown? . . .
Yes, sorry, I missed that.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Yes, sorry, I missed that.


Thanks.
 
Arun C. Giridharan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Fails to handle two Exception Objects ONLY ArrayIndexOutOfBoundsException is thrown ...ON THE ABOVE EXAMPLE ...
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Giridharan wrote:Java Fails to handle two Exception Objects ONLY ArrayIndexOutOfBoundsException is thrown ...ON THE ABOVE EXAMPLE ...


Did you go through the link which I gave you? They intently do this.
 
Arun C. Giridharan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They intently do this.
but it doesn't make any sense ....why overruled come into picture ... (or is it some kind of rule ???)

 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Giridharan wrote:but it doesn't make any sense ....why overruled come into picture ... (or is it some kind of rule ???)


OK, then If I asked, what do you do with those two exceptions?
 
Arun C. Giridharan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exception are meant to be handled (of corresponding one) ! through Structured way
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic