Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1378 :

Posted: Fri Oct 19, 2018 4:56 pm
by flex567
Why does the first option compiles.
From the answer:
The number at //1 and //2 are actually the same. Although confusing, it is legal to have multiple underscores between two digits.

This is a sentence from the book:
To make it easy to read and comprehend large numbers, Java allows underscores in numeric literals. For example, 1000000.0 can also be written as 1_000_000.0. You cannot start or end a literal with an underscore, and cannot use multiple underscores consecutively.

Re: About Question enthuware.ocajp.i.v7.2.1378 :

Posted: Fri Oct 19, 2018 9:39 pm
by admin
That's look like a mistake in the book. You can have multiple underscores consecutively. I am adding it to the errata.
thank you for your feedback!
Paul.