This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes 2 objects EXCEPTION Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "2 objects EXCEPTION" Watch "2 objects EXCEPTION" New topic
Author

2 objects EXCEPTION

Arun C. Giridharan
Ranch Hand

Joined: Jul 11, 2010
Posts: 96



ONly 1 exception is thrown out ....


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


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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 !


[My Blog]
All roads lead to JavaRanch
Arun C. Giridharan
Ranch Hand

Joined: Jul 11, 2010
Posts: 96
Thank you Verré ! ...
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Can you explain why you expect more than one exception ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38052
    
  22
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

Joined: Nov 04, 2009
Posts: 2066

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


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38052
    
  22
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

Joined: Nov 04, 2009
Posts: 2066

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

Joined: Oct 13, 2005
Posts: 38052
    
  22
Abimaran Kugathasan wrote: . . . Won't ArrayIndexOutOfBoundsException be thrown? . . .
Yes, sorry, I missed that.
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Campbell Ritchie wrote:Yes, sorry, I missed that.


Thanks.
Arun C. Giridharan
Ranch Hand

Joined: Jul 11, 2010
Posts: 96
Java Fails to handle two Exception Objects ONLY ArrayIndexOutOfBoundsException is thrown ...ON THE ABOVE EXAMPLE ...
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

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

Joined: Jul 11, 2010
Posts: 96
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

Joined: Nov 04, 2009
Posts: 2066

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

Joined: Jul 11, 2010
Posts: 96
Exception are meant to be handled (of corresponding one) ! through Structured way
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 2 objects EXCEPTION
 
Similar Threads
Exception
Aquestion from the test #132
Exception Handling!!!
doubts on try and finally block
Best way to get input