This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Missing information in OCAJP Java 8 Jeanne Boyarsky and Scott Selikoff study guide - page 73

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there are other 2 data types(double and float) and their wrappers that aren't supported by switch statement.

We should add them the sentence at page 73 as below:
"For the exam, we recommend you memorize this list. Note that float, double, boolean, long, and
their associated wrapper classes, are not supported by switch statements."
 
Ranch Hand
Posts: 279
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javid,
Not a bad idea (I guess), but page 72


Prior to Java 5.0, this variable could only be int values or those values that could be promoted to int, specifically byte, short, char, or int.



and then goes on to explicitly bullet point

Data types supported

 
Charles O'Leary
Ranch Hand
Posts: 279
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In other words, I don't think that it's "truly" missing, it just didn't get repeated.  Right?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a paragraph starting with "Data types supported", it's really obvious that all data types mentioned in the list are supported in a switch statements and all others are not. But if you make an additional note to mention data types which are not supported, I would list them all instead of arbitrarily choosing two of them. Because noiw the reader could be confused and be thinking: what about float and/or double? one of the lists is wrong here.

And honestly the quote of page 72 by Charles does not provide any useful information and the reader could still be in doubt. Because he knows that neither of the types boolean, long, float and double can be promoted to an int. So he's wondering why boolean and long are mentioned in the "not supported" list; but float and double are not.
 
Charles O'Leary
Ranch Hand
Posts: 279
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


And honestly the quote of page 72 by Charles does not provide any useful information and the reader could still be in doubt.



For the record, I think I just made the same "error" that the authors made:  My intent with the quote wasn't to "duplicate" the bulleted items, but to highlight where it was discussed in the book ... since you most likely need the book in your hand to determine if something is missing from it.

Roel,  I agree on all the points you (and implicitly Javid) raised!
 
author & internet detective
Posts: 39530
776
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We chose to highlight boolean and long there because more people think those should be supported. (since there are a finite number of values). But yes, we could have explicitly repeated double and float.
 
Javid Azimli
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:We chose to highlight boolean and long there because more people think those should be supported. (since there are a finite number of values). But yes, we could have explicitly repeated double and float.



Yeap, I think it'd better to mention float and double explicitly together with boolean and long for clarity.Beginners may misunderstand.Thanks for reply.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:We chose to highlight boolean and long there because more people think those should be supported. (since there are a finite number of values).


Honestly you would be completely crazy to use a switch statement for boolean It requires so much more code to write than a simple concise if statementAnd what if you added the default case as well? Do you expect an "unreachable code" compiler error?
 
All of the following truths are shameless lies. But what about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!