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

Errata for OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide - Second reading

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

I finished my second reading of the book and here are some more typos/errors that I discovered. I will put everything here so this post will be pretty long.

  • In the Assessment Test , question 20, I'm guessing the "B." should be removed in option B.


  • There shouldn't be a closing brace on page 9 at the bottom of the page after the method declaration

  • In the middle of page 61, the main() method should be declared as static


  • On page 86, in the box (in Introducing Anti-Patterns), the last line says
  • [...]may come in and added[...]


    while it should be

    [...]may come in and add[...]



  • On page 113, not using generics doesn't seem to produce a compiler warning

  • On page 113, in the box What You Can't Do With Generic Types,
  • [...]but it will helpful[...]


    should be

    [...]but it will be helpful[...]



  • On page 120, I also think the explanation could be more precise, as explained in this thread


  • On page 139, the table 3.6 should contain the following signature for the method containsValue(): boolean containsValue(Object value), with description "Returns whether value is in map"


  • In the review questions of chapter 3, question 24 on page 170, replace "print outs" by "prints out"


  • On page 209, I find table table 4.8 quite confusing. It seems that the first two methods listed act on optionals while the last three act on primitive streams


  • In the review questions of chapter 4 on page 230, the explanation of question 14 (see page 557) could be more detailed. It says:
  • [...]Converting from a double to an int would require a cast inside the lambda


    As I've tested it, I don't agree that this requirement is sufficient for the code to compile, because an IntStream is not the same as a Stream<Integer>
    But it will compile using the following additional conversion:However, since the stream s is considered to already having been used, it cannot be used anymore on line 3 and an exception is thrown

  • At the bottom of page 305, it is said that DateTimeParseException is a checked exception while it is an unchecked exception. Same mistake at the top of page 315.


  • At the bottom of page 348, I suggest to replace:
  • [...]While a single-thread executor will wait for an available thread to become available[...]


    by

    [...]While a single-thread executor will wait for a thread to become available[...]



  • In the middle of page 364, it is actually an UnsupportedOperationException that is thrown if we had used a regular ArrayList.


  • At the top of the page 365, it says
  • [...]These methods, defined in the Collection class, contain synchronized methods that operate[...]


    Well, methods do not contain methods. The following might be more correct:

    [...]These methods, defined in the Collection class, operate[...]



  • On page 368, in the box Ordering forEach Results, it says:
  • [...]Also, stream operations that occur before/after the forEachOrdered()[...]


    I don't see how operations could be operated after the stream has been consumed by forEachOrdered()

  • On page 371, in the section Avoiding Stateful Operations, I would replace
  • [...]Let's take a look an example[...]


    by

    [...]Let's take a look at an example[...]



  • On page 372, in the paragraph before the box, I would replace
  • It strongly recommended[...]


    by

    It is strongly recommended[...]



  • On page 374, in the excerpt at the top, c and s1 should be inverted.


  • On page 374, the section Requirements for reduce() Arguments might required some more details. Just for the identity rule, do we combine the identity with the whole stream as written (in which case the statement "for all elements" is useless) or each element individually?


  • On page 375, the title of the section
  • Combing Results with collect()


    should be

    Combining Results with collect()



  • In the middle of page 382, it says
  • Conceptually, we start off with a single zoo worker who realizes that they cannot[...]They perform[...]


    I think the following should be more correct:

    Conceptually, we start off with a single zoo worker who realizes that he/she cannot[...]He/she performs[...]



  • At the bottom of page 382, it says ForkJoinTask is an interface while it is actually an abstract class.


  • At the bottom of the page 390, it says
  • In practice, livelock is often very difficult issue to detect[...]


    while it should be

    In practice, livelock is often a very difficult issue to detect[...]



  • On page 414, in the paragraph before the code excerpt, replace FileWriter by FileReader and BufferedWriter by BufferedReader.


  • On page 416, at the end of the section Stream Base Classes, it says
  • [...]instantiate an instance of it.


    The following should be more correct

    [...]create an instance of it.



  • On page 417, table 8.2 should ideally also include BufferedInputStream and BufferedOutputStream.


  • On page 442, the last line before Summary should actually refer to the method of the class Arrays.


  • On pages 457, 458 and 459, it says that the examples are rewritten in different manners but path3 sometimes refer to a file named zoodirector and sometimes another named zoodirectory. This name should be consistent across examples.


  • On page 465, at the bottom, it says the method toAbsolutePath() returns a new Path object with the same value while it is in fact the same object.


  • On page 468, in the box, the line that throws an exception should be path1.relativize(path3); (lowercase).


  • On page 469, at the end of the section Joining Path Objects with resolve(), the path returned by the method resolve() is also the same object in this case.


  • On page 470, at the end of the section Cleaning up a Path with normalize(), it says
  • [...]Java provides a way to verify that the file does exactly exist.


    while it should be

    [...]Java provides a way to verify that the file does actually exist.



  • On page 507, it says that there are two main ways to access a relational database from Java while there are five bullet points. The last three points should be preceded by another sentence introducing them.


  • On page 514, in the first paragraph, what is meant for the second part is actually the name of the vendor.


  • On page 517, at the bottom, the folder structure is not really clear to me. It looks like java.sql.Driver is at the same level as service while it is actually inside it.


  • On pages 516, 517, 518, 536 and 539 (and maybe some other places), the directory is said to be META-INF/service while it is in fact META-INF/services. In any case, the name is not consistent across the chapter I think, sometimes singular, sometimes plural.


  • On page 566, answer for question 10, the option F seems incorrect to me as the method delete() returns false when the directory does not exist. However, the method Files.delete(Path) in NIO.2 does return an exception in such a case.


  • On page 567, at the end of the answer for question 19, instead of
  • [...]Just answer as best you can.


    I would have written

    [...]Just answer the best you can.



  • On page 578, at the end of the section Create a Study Plan,
  • [...]to be prepared to the take the exam.


    should be

    [...]to be prepared to take the exam.



    Kind regards,
    Guillaume
     
    author & internet detective
    Posts: 42003
    911
    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
    I really appreciate your taking the time to type this up!

    Assessment #20 - confirmed
    page 9 - confirmed
    page 61 - confirmed
    page 86 - confirmed
    page 113 - It depends on your compiler settings. In an IDE or using javac -Xlint TestClass.java, it does give a warning. For example: (I used a different class name and subset of the class in order to test at the command line)



    I’ve added a note to myself that we could make this clearer, but I don’t think it is an errata.

    page 113 - confirmed typo in real world scenario
    page 120 - agreed and captured when I read that thread earlier today. Thanks for the cross reference to that thread!
    page 139 - confirmed
    page 170 - confirmed
    page 209 - noted for a future edition. Not an errata though as the text is what we wrote
    page 230 - you are correct. Also noted for a future edition (to make it an IntStream). It isn’t wrong in the sense that sentence was just pointing you to a compiler error. The answer section isn’t the place for describing how to fix it at length
    page 305 etc - Shoot! You’re right, it is an unchecked exception
    page 348 - agreed. If the thread was available, we wouldn’t be waiting!
    page 364 - I get a ConcurentModificationException as the book says

    UnsupportedOperationException typically comes up when a class doesn’t implement a method from the interface at all.

    page 365 - confirmed
    page 368 - Good catch! Nothing can happen after forEachOrdered as it is a terminal operation!
    page 371 - confirmed
    page 372 - confirmed
    page 374 - confirmed
    page 374 identity - “I think it should be more thorough” isn’t an errata . It is useful feedback though.
    page 375 - confirmed
    page 382 - while he/she is better than they, it’s not terrible so noting privately and not in the errata list
    page 382 - confirmed class vs interface
    page 390 - confirmed
    page 414 - confirmed
    page 416 - I don’t think that is wrong. You instantiate a class when you create it, no? I wonder if this a language thing here that I’m not picking up on.
    page 417 - BufferedInputStream and BufferedOutputStream aren’t in the exam objectives. Granted if you understand the table, you should be able to figure out what they do. But having the table go longer than page to cover something not in the objectives doesn’t seem worth it to me.
    page 442 - confirmed
    page 457-459 - confirmed
    page 465 - good catch! I didn’t know it was the same object until I just tried it and looked at the JavaDoc.
    page 468 - confirmed
    page 469 - agreed!
    page 470- confirmed
    page 507 - Agreed. The last three bullets were separate paragraphs in the manuscript I submitted
    page 514 - I don’t understand your confusion here. The second part is something like postgres which is a database/vendor name. Can you start a new thread to ask about this one since it is a question and I could see us having a discussion about it?
    page 517 - I don’t understand. I see “service/java.sql.Driver” which implies one level down.
    pages 516, etc - confirmed. It should be META-INF/services
    page 556 - We should remove choice F. IT could throw a null pointer or any other exception. It’s not a good thing to ask and certainly not something you need to know for the exam.
    page 567 - it reads ok to me, even if not correct according to the rules of grammar.
    page 578 - agreed
     
    Guillaume Bailly
    Ranch Hand
    Posts: 90
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for your answer.

    Sorry if it was a little bit mixed up. Not everything was errata material.

  • page 113: of course, tested with -Xlint and got a warning
  • page 364: tested with your code and got a ConcurentModificationException, no problem
  • page 416: I just had a problem with the repetition. Instantiate is already "create an instance" for me, so what you're saying is "create an instance an instance", but just a language peculiarity I guess
  • page 417: hmm, ok, I was confused about BufferedInputStream and BufferedOutputStream since they are described later on page 422
  • page 514: I just wanted to avoid the confusion between vendor name (second part) and database name (third part)
  • page 517: it says the following, and only by looking at this I'm not sure if java.sql.Driver is inside service or next to it
  • META-INF
    - service
    - java.sql.Driver


  • page 567: ok, sure, I'm not native English speaker anyway

  • Guillaume
     
    Jeanne Boyarsky
    author & internet detective
    Posts: 42003
    911
    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

    Guillaume Bailly wrote:

  • page 517: it says the following, and only by looking at this I'm not sure if java.sql.Driver is inside service or next to it
  • META-INF
    - service
    - java.sql.Driver


    Oh! That's on page 516 in my copy. It's definitely a rendering error. The third line should be indented further
     
    Jeanne Boyarsky
    author & internet detective
    Posts: 42003
    911
    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

    Guillaume Bailly wrote:On page 468, in the box, the line that throws an exception should be path1.relativize(path3); (lowercase).


    Ooh. Sander found another error in that line. path3 should be path2 as there is no path3 defined at that point.
     
    Ranch Hand
    Posts: 74
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    On page 465, at the bottom, it says the method toAbsolutePath() returns a new Path object with the same value while it is in fact the same object.


    Same page:

    If the Path object is already absolute, then the method just returns an equivalent copy of it.


    This is a different statement about the same topic and should be corrected also.
     
    Jeanne Boyarsky
    author & internet detective
    Posts: 42003
    911
    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
    Noted, thanks.
     
    Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
    Gift giving made easy with the permaculture playing cards
    https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    reply
      Bookmark Topic Watch Topic
    • New Topic