Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Alisa Crowe

Greenhorn
+ Follow
since Apr 26, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alisa Crowe

Thank you for your quick reply.  But the book says that this will either have a runtime exception or produce at least one line of code.
That is what I don't understand.  My example shows that it will successfully run and produce no output, which is in contradiction with
the answer in the book.
Thank you again, Lisa
I realize this has been explained, but I still have a question.  

If house.getChickens().size() = 0, then the for loop is never executed, resulting in no output- happily so even.
I thought the update statements aren't touched until after the body executes, which it never does.



This compiles and runs without any output.  What am I missing?  Thank you

Thank you for your quick reply.  But the book says that this will either have a runtime exception or produce at least one line of code.
That is what I don't understand.  My example shows that it will successfully run and produce no output, which is in contradiction with
the answer in the book.
Thank you again, Lisa