Hello, in the book OCA: Oracle®Certified Associate Java®SE 8 Programmer IStudy GuideExam 1Z0-808,
page 96 I encountered the following question which confused me:
How many times will the following code print "Hello World"?
A. 9
B. 10
C. 11
D. The code will not compile because of line 3.
E. The code will not compile because of line 5.
F. The code contains an infinite loop and does not terminate.
The correct answer is F that this loop is an infinite loop.
My questions are:
I understand that in the for loop it is optional to add the third field.
The thing that confuses me is that if we don't add the third field then the code compiles but every time it initializes i to 0?