All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.
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.
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.
If you like our products and services, please help us by posting your review here.