This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!

Cedric Georges

Greenhorn
+ Follow
since Mar 18, 2015
Cows and Likes
Cows
Total received
3
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Cedric Georges

I don't understand the last example of page 319 (the example which doesn't compile).

I tried the following code, which works fine:
NetBeans give me the following output:
Am I missign something?

Thank you for your help!
After the example of page 312, explanations are given. But I really don't understand the following sentences:

If the close() method does throw an exception, Java looks for more catch blocks. There aren't any, so the main method throws that new exception. Regardless, the exception on line 28 is handled.


I think the exception throwed by the close() method is caught by the catch block on lines 23-24. Hence, in my point of view, it's not correct to say

... Java looks for more catch blocks. There aren't any, ...


Am I misunderstanding something here (maybe my poor english knowledges aren't helping me...)?

Thank you for your help!
The paragraph beginning with :

As we see in this example, the compile will ...


should be modified as :

As we see in this example, the compiler will ...



Is that correct?
In the first paragraph after the #2 in "Inheriting an Interface", the following text:

Like an abstract class, an interface may be extended using the extend keyword.


should be replaced as follow:

Like an abstract class, an interface may be extended using the extends keyword.



Is that correct?
At the top of page 249, in the second paragraph, we can read :

The second method, eat(), is overridden in the subclass Eagle ... the return type of the method in Eagle must be a subclass of the return type of the method in Bird. In this example, the return type void is not a subclass of int ...


But, according to the example of page 248, the explanation should be :

In this example, the return type int is not a subclass of void ...


since the return type of eat() is int in Eagle, and void in Bird.

Is that correct?
According to my poor english knowledges, on the top of page 239 (at the end of the first paragraph), the following statement:

Notice the user of both super() and super(age)


sould be written as:

Notice the use of both super() and super(age)



Is that correct?
The answer on page 342 gives:

The code does not compile


But, according to the answers (A, B, D), this code does.
The solution on page 340 says:

The if statement on line 18 returns false because ...


I think this should be corrected as follow:

The if statement on line 18 returns true because ...


Is that correct?
For this question, the solution on page 339 says:

Line 7 also compares references but is true since both references point to the object from the string pool. Finally, line 8 compares one object from the string pool with one that was explicitly constructed and returns false.


The solution should gives:

Line 8 also compares references but is true since both references point to the object from the string pool. Finally, line 9 compares one object from the string pool with one that was explicitly constructed and returns false.


Or am I misunderstanding something?
On page 146, in section "Converting to a long", the text is indicating that LocalDateTime has a toEpochTime() function that can be used to convert a LocalDateTime into a long.

I have tried this function:

But NetBeans gives me the following result:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code -
Erroneous sym type: java.time.LocalDateTime.toEpochTime at ...



On http://docs.oracle.com/javase/8/docs/api/, I don't find anything about toEpochTime. But there is a toEpochSecond function.

Can you help me please?
No, it isn't a typo. This could be an addition in the book, showing the possibility of using this new method.
On top of page 126, the following code is wrong:

"[]" are missing after "int":
On the other hand, a new sorting method was introduced with Java SE8:


See https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html (bottom of page)
On page 124, chapter "Sorting", there is a missing semicolon:


This line of code should be corrected as follow: