Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Matus Iglarcik

+ Follow
since Feb 29, 2016
Matus likes ...
Eclipse IDE C++ Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matus Iglarcik

In answer to question 22 (Chapter 9: NIO.2) there is:

The APPEND option creates the file if it does not exist...

It refers to this code:

If the file does not exist, function newBufferedWriter will create it if:
  • no option at all is present (in this case method works as if the CREATE, TRUNCATE_EXISTING, and WRITE options are present; link to java docs)
  • option for creating is present (CREATE/CREATE_NEW)

  • Since StandardOpenOption.APPEND is already present, option for creating file must by written explicitly. Otherwise NoSuchFileException is thrown when file does not exist.
    Therefore option B is not correct and option C is correct.
    Chapter 8, page 454, there is:

    it should be:

    Object args... -> Object... args
    Chapter 7, page 356, after output example there is a typo:

    With a single-thread executor, results are guaranteed to be executed sequentially.

    it should be:

    With a single-thread executor, tasks are guaranteed to be executed sequentially.

    Chapter 4, page 221, in the middle of the page there is:

    The other methods would return an empty optional

    Actually methods getAverage(), getMax() and getMin() don't return Optional.
    @Tomasz Kasprzyk, good to know. thanks. @Campbell Ritchie, ignore my request please.
    Campbell Ritchie please could you unlock my thread. I created it so I can add another errors in the future, but it is locked now.

    Campbell Ritchie wrote:. . . using straight K and V can cause a program to fail to compile...

    You are right. Simplification used in the table can cause code not to compile. Therefore there is a note about it right before the table. The point of the table is to explain methods behavior not generics.
    Chapter 3. In Table 3.7 Map methods (page 130), it is written:

    it should be:

    Campbell Ritchie wrote:...
    Both are incorrect;

    Signature is simplified to make it easier to understand.

    Tomasz Kasprzyk wrote:...
    and create your own thread

    Thanks, i didn't notice it in the instructions.
    Chapter 3. In Table 3.7 Map methods (page 130), it is written:

    it should be: