• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Errata on Chapter 2 Review Question #18 (Java OCA 8 Programmer I Study Guide, Sybex)

 
Juan Cornelio Guzman
Greenhorn
Posts: 6
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the output of the following code snippet?
3: int count = 0;
4: ROW_LOOP: for(int row = 1; row <=3; row++)
5: for(int col = 1; col <=2 ; col++) {
6: if(row * col % 2 == 0) continue ROW_LOOP;
7: count++;
8: }
9: System.out.println(count);
A. 1
B. 2
C. 3
D. 4
E. 6
F. The code will not compile because of line 6.


The answer is B. But on the Appendix A, the answer is A.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Juan Cornelio Guzman,

First of all, a warm welcome to CodeRanch!

Juan Cornelio Guzman wrote:The answer is B. But on the Appendix A, the answer is A.

You are correct! But this typo is already added to the official errata overview (check page 338). It was reported here.

Hope it helps!
Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic