Juerg Bauman

Ranch Hand
+ Follow
since Sep 22, 2017
Cows and Likes
Cows
Total received
1
In last 30 days
1
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Juerg Bauman

Mock exam#2 - the question with System.console / Writer / append:
It's the same topic as mentioned earlier. It's true that the Writer append() method throws an IOException, for compile time reasons this exception has to be catched/declared.
But the instance is of type PrintWriter, its append() is overridden and no IOException can be thrown.
The Option E: An IOException may be thrown is incorrect.
Writer readline() could throw an IOError, not Exception.
Page xliii - Assessment Test #11:

C. magic(Stream.iterate(1, x ->> x++)); ...
D. ...


I'm not sure wether the lambdas in option C and D are incorrect intentionly or it's just a typo.
Page 542 - explanation#2:

... so the creators of the exam iare free to ...


just a typo
Page 361 - question#18:

Given the table books in the figure...
...
select * from cert where title = 'OCA'


It should be: select from books ...
Page 565 - explanation#5:

The append() method throws an IOException.


The Console method writer() returns PrintWriter, its append() is overridden and does not throw any checked exceptions anymore.
JavaDocs says to PrintWriter:

Methods in this class never throw I/O exceptions, ...


Page 523 - explanation#15:

Finally, because both can be used with a byte array, Option D is incorrect.


OutputStream uses byte[], while Writer uses char[].
Page 394 - question#3:

The get() method throws checked exceptions which are not handled in the code. For me an error, for you ... I already know your answer.
For me it's very weird to assume, that these exceptions are declared somewhere else ( f.e. in main()), not visible in the code since it's only a code snippet.
It's worse than the topic of missing import statement.
On page 345 - question #19: not an error, just a suggestion

I was surprised that this line actually did compile, because execute() takes a Runnable with return type void. The method getAnswer() has return type String.
The explanation: https://coderanch.com/t/690723/java/ExecutorService-execute-Runnable
Possibly I didn't get that fact earlier, maybe you could add it to your explanation.

hi all,
I don't understand why line #3 is compiling without any problem. There is only one execute() method in ExecutorService which takes a Runnable, and Runnable run() returns void.
Line #3 shouldn't compile because toString() has an incompatible return type. But it does.
Line #4 does not compile, the compiler error is: bad return type in Lambda expression.
Thank you, Juerg
Page 504 - explanation #22:

The method reference is used for Supplier, not Consumer, since it takes a value and does not return anything.


It should be reverse: ... is used for Consumer, not Supplier, ...
Page 494 - explanation #29:

C. Dinosaur.new Pterodactyl();
...
Option C is incorrect. Pterodactyl is a member inner class, not a static nested class.


Option C is not working even for static nested classes. The correct syntax would be: new Dinosaur.Pterodactyl() or just new Pterodactyl()
Page 196 - question#21 (singleton pattern):
It's just a doubt, probably not an error.

It's about the instance variable which is not declared final. According to your Study Guide, instance should be static final (unless lazy instantiation).
Otherwise there is no method inside the class capable to reassign instance. I suggest you could loose some words in your explanation, that it is ok to omit the final keyword in this case.
Page 475 - Files.move(Path, Path):

By default, the move() method will follow links, ...
These behaviors can be changed by providing the optional values NOFOLLOW_LINKS , REPLACE_EXISTING , or ATOMIC_MOVE , ...


The JavaDoc says:

If the file is a symbolic link then the symbolic link itself, not the target of the link, is moved.


Furthermore there is no option parameter NOFOLLOW_LINKS available for this method.
Page 304 - question#10:

For a given file, the absolute is the path from ...
... while the relative path is the path from ...


Typo: For a given file, the absolute path is the path ...
Page 302 - question#4:

Which methods are classes that implement java.io.Serializable required to implement?


I'm not english native, but something is wrong with that sentence.