• 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
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

[Sybex][possible errata] OCP 11 Programmer I Study Guide, p. LIII, Intro, question 11

 
Tomasz Kasprzyk
Ranch Hand
Posts: 34
5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

In the explanation it is written:

(...) it is implicitly cast to a short, (...)


I think it should be

(...) it is explicitly cast to a short, (...)



Cheers,
Tomasz
 
Campbell Ritchie
Marshal
Posts: 80945
522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welome to the Ranch Please supply more details so those of us who don't have the book can understand the question better.
 
Tomasz Kasprzyk
Ranch Hand
Posts: 34
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The 11th question of the assessment test:

Which of the following expressions compile without error? (Choose all that apply.)
A. int monday = 3 + 2.0;
B. double tuesday = 5_6L;
C. boolean wednesday = 1 > 2 ? !true;
D. short thursday = (short)Integer.MAX_VALUE;
E. long friday = 8.0L;
F. var saturday = 2_.0;
G. None of the above



And the fragment of the explanation for answer D. (with the proposed correction):

Option D is correct. Even though the int value is larger than a short, it is implicitly explicitly cast to a short.

 
Campbell Ritchie
Marshal
Posts: 80945
522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the information; “explicitly” is correct. Please wait for Jeanne Boyarsky to see your post and look here; that doesn't appear to hae been noticed before.
 
Jeanne Boyarsky
author & internet detective
Posts: 42173
937
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Confirmed and added to the errata. Good catch!
 
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic