aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes how exception handle in this example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "how exception handle in this example" Watch "how exception handle in this example" New topic
Author

how exception handle in this example

chain singh
Ranch Hand

Joined: Feb 28, 2012
Posts: 117




result is :

Entering try statement
asdfsdf
asdfsdf111
Closing PrintWriter
Caught ArrayIndexOutOfBoundsException: 10 >= 10




Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3742
    
  16
What's your actual question ? What is it you don't understand ?


Joanne
chain singh
Ranch Hand

Joined: Feb 28, 2012
Posts: 117
actully i dont understood that result which is coming from that code.

it call 2nd statement of catch block first and than call 1st statement of catch block. than finally block and than again catch block.


Please explain me how this result coming.

thanks for reply
chain singh
Ranch Hand

Joined: Feb 28, 2012
Posts: 117
actually i do not understood that result which is coming from that code.

it call 2nd statement of catch block first and than call 1st statement of catch block. than finally block and than again catch block.


Please explain me how this result coming.

thanks for reply
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3742
    
  16
Notice that some of the print statements are going to System.out and some are going to System.err. These are two separate streams that (by default) write to the same place. Because they are separate streams there is no guarantee as to the order the output text will appear. The only things that are guaranteed is that all the System.out statements will appear in the order in which they are encountered in the code and all the System.err statements will appear in the order in which they are encountered in the code, but these two sets of outputs could be mixed up with each other.
If you change the print statements to all use System.out or all use System.err they will appear in the expected order.
 
 
subject: how exception handle in this example