• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

OCA Java SE 8 Programmer I typo page 337

 
Ranch Hand
Posts: 216
11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 2 Explanation 7.

Since x is greater than 2, the answer is 8, or option D in this case.

It should be Since x is greater than 4

by alinvlad05
 
Bartender
Posts: 3955
43
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vlad,

Can you give more context, so people who do not own the book can judge is this is a real error?

Thanks
 
Vlad Alin
Ranch Hand
Posts: 216
11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
int x = 5;
System.out.println(x < 4 ? 10 : 8);
 
Vlad Alin
Ranch Hand
Posts: 216
11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's just a simple typo.
 
Mikalai Zaikin
Bartender
Posts: 3955
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agree, seems like edited in 1 place, but forgot to edit in second place.
 
author & internet detective
Posts: 42103
933
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Confirmed this is a typo. I've added it to the errata. I also checked the Java 11 book and the question was not included there.
 
Jeanne Boyarsky
author & internet detective
Posts: 42103
933
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Update: this is not an error. That part of the explanation goes with later code:

System.out.println((x ˃ 2) ? 8 : 7)

Since x is greater than 2, the answer is 8, or option D in this case.

 
Always! Wait. Never. Shut up. Look at this tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic