Win a copy of Svelte and Sapper in Action this week in the JavaScript 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Some minor things I noticed in chapter 1 (Java OCA 8 Programmer I Study Guide, Sybex)

 
Greenhorn
Posts: 1
1
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am creating this topic because I noticed some content in the book which might not be fully true (But I might be mistaken, hence posting it in a seperate topic and not in the stickied thread).

Page 30
The code given on page 29 is shown with line numbers 4-9 with the compile error on line 7. The error shown on page 30 shows the error being on line 5, which is

in the code, which is not the error.

Page 34
Bit of a minor detail, perhaps out of the scope of the book.
However the book states that Class variables are in scope from declaration till the program ends. However classes can be GC'ed in java given that there are no references to the given class loader.

Page 36
States that objects are collected when:
  • The object has no references pointing to it
  • All references have gone out of scope


  • My question is why doesn't this say anything about weak/soft references?

    Page 40, possibly also in previous pages


    Numerical literals are also allowed to begin with 0 (octal), 0x (hex), 0X (hex), 0b (binary) or 0B (Binary).


    Numerical literals according to the Oracle page includes floating point numbers (Since the example includes a float name = ...).
    A minor detail/pitfall is that while a 0 prefix for a integer number (so without a decimal dot) becomes octal, the same does not go for constants that are interpreted as floating point numbers.
    For example:





     
    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
    Hi Stefan Feenstra,

    First of all, a warm welcome to CodeRanch!

    Stefan Feenstra wrote:I am creating this topic because I noticed some content in the book which might not be fully true (But I might be mistaken, hence posting it in a seperate topic and not in the stickied thread).


    Thanks for taking the time to create a new topic about your concerns/doubts about possible errata in the study guide. The authors will really appreciate it! Please note that the stickied thread is about the errata of a different study guide (K&B7) covering OCA7 and OCP7. So posting it in a seperate topic was definitely the right thing to do

    Stefan Feenstra wrote:Page 30The error shown on page 30 shows the error being on line 5


    You are correct! This minor issue was already reported and is already added to the official errata overview (maintained by the authors).

    Stefan Feenstra wrote:Page 34
    Bit of a minor detail, perhaps out of the scope of the book.
    However the book states that Class variables are in scope from declaration till the program ends. However classes can be GC'ed in java given that there are no references to the given class loader.


    That is indeed waaay beyond the scope of the study guide.

    Stefan Feenstra wrote:Page 36
    My question is why doesn't this say anything about weak/soft references?


    That is again way beyond the scope of the study guide. I believe it is even not in the scope of the OCPJP study guide.

    Stefan Feenstra wrote:Page 40, possibly also in previous pages
    Numerical literals according to the Oracle page includes floating point numbers (Since the example includes a float name = ...).
    A minor detail/pitfall is that while a 0 prefix for a integer number (so without a decimal dot) becomes octal, the same does not go for constants that are interpreted as floating point numbers.


    You are correct! And this edge case might be covered in the next version of the study guide. Very similar: if you use the suffix D or F with hexadecimal notation, it is considered as part of the literal and not the suffix for double or float. An illustrative code snippet of this behavior can be found here.

    Hope it helps!
    Kind regards,
    Roel

    PS. Have a cow for creating a very nice topic which comprises all your concerns/doubts about possible errata in one specific chapter. That makes it really very convenient for the authors to handle them. Also providing an illustrative code snippet is great!
     
    author & internet detective
    Posts: 40200
    816
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Roel De Nijs wrote:You are correct! And this edge case might be covered in the next version of the study guide. Very similar: if you use the suffix D or F with hexadecimal notation, it is considered as part of the literal and not the suffix for double or float.


    While I agree you are correct, this too is out of scope for the exam. The goal of the book is to get ready for the exam, not to cover every edge case in Java.

    Stefan: you clearly have a good knowledge of Java. Make sure you don't overthink questions on the exam!
     
    Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
    the value of filler advertising in 2020
    https://coderanch.com/t/730886/filler-advertising
      Bookmark Topic Watch Topic
    • New Topic