Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!

Paweł Baczyński

+ Follow
since Apr 18, 2013
Paweł likes ...
IntelliJ IDE Firefox Browser Spring Java Linux
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paweł Baczyński

Hello Scott and Jeanne

Does your book mention the upgrade exam (1Z0-817)?

EDIT: I am answering my own question... Yes, the book even says that on its cover.  
The best part of doing the beta is the price.
The wors part is not knowing if you passed for some time.
From javadoc:

javadoc wrote:Returns:
   true if the named file does not exist and was successfully created; false if the named file already exists

And the method does throw exceptions:

javadoc wrote:Throws:
   IOException - If an I/O error occurred
   SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method denies write access to the file

7 months ago
Java 14 release is scheduled for general availability on March 17, 2020. It introduces three changes to the language and one useful feature for runtime.

Read more about it at:

Mike Savvy wrote:I mean something like this:

This can be emulated using method overloading.

This prints:

Note that selecion of a method to call happens on compile time.
7 months ago
You can pass an instance of an object implementing some interface (Function, UnaryOperator).
9 months ago

Campbell Ritchie wrote:Remembering that n % 2 == 1 doesn't reliably find odd numbers.

Forget the 1. Compare to 0. You'll get n % 2 != 0 that reliably finds odd numbers.
11 months ago
Also, don't write

Instead write
1 year ago

Piet Souris wrote:then b.m1() is illegal.

If you program to the interface, you won't need an instance method called m1() as such method is not defined in the interface.

Similarly, when you program to interfaces with lists like List<String> list = new ArrayList<>(); you don't expect to be able to call list.ensureCapacity(123);.
1 year ago

Dave Tolls wrote:Indeed, looking at the Arrays source code and it does use its own private class.

And the private class is named ArrayList.

But it isn't java.util.ArrayList. It is java.util.Arrays.ArrayList.

1 year ago
It would help if you shared what you don't get.
1 year ago
It is, however, possible to "leak" the instance into other thread before final variable is assigned.

Be warned. This code is obscure.
It shows why you shouldn't "leak" the this from a constructor and why you shouldn't start threads inside a constructor.

It prints:
[The value is: null]
[The value is: value]

What doubts do you have? You didn't ask any question.

Also, please use code tags.
1 year ago
At the office we discussed if writing an article about client types is a good idea. After some discussion one became clear - good client will laugh at it, lousy client will not read it.

If you have any comments or suggestions, please let me know!

1 year ago