Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with exception  RSS feed

 
Emilian Chmiel
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.0. I wrote a program:


1.1. outcome:

5 / 10 = 0
10 / 20 = 0
15 / 30 = 0
0 / 40 = 0
0 divine

2.0. But:

2.1. Outcome:

5 / 10 = 0
10 / 20 = 0
15 / 30 = 0
0 / 40 = 0
0 divine

what about ArrayIndexOutOfBoundsException exc2 ? Why it is not visible ?
 
Tim Cooke
Marshal
Posts: 4040
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the 5th iteration of the loop, what would be the result of 0/0 ?
 
Norman Radder
Ranch Hand
Posts: 146
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Does the execution exit the loop so that condition does not happen?
 
vinodh kumar Thimmisetty
Greenhorn
Posts: 2
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Emilian Chmiel,
Once the Exception is thrown, control will never return back to original execution step i.e., compiler won't let execute any steps and break the loop
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!