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

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.

Moderators: Site Manager, fjwalraven

Post Reply
flex567
Posts: 202
Joined: Mon Apr 02, 2018 8:40 am
Contact:

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

Post 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.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests