• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OCA Java SE 8 Programmer I typo page 337

 
Ranch Hand
Posts: 215
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: 3908
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: 215
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: 215
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: 3908
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: 41871
908
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: 41871
908
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.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic