[HD Pg 56, Sec. 3.1.0 - data-types-in-java]

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
Arold Aroldson
Posts: 21
Joined: Mon Nov 20, 2017 8:00 am
Contact:

[HD Pg 56, Sec. 3.1.0 - data-types-in-java]

Post by Arold Aroldson »

Hi! I have a question about Data Types. If char's range is 0 to 2^7-1 why is it 0 to 65,535? 2^7-1 is 127 isn't it?

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

Re: [HD Pg 56, Sec. 3.1.0 - data-types-in-java]

Post by admin »

That looks like a typo. char is 16 bits, which means 0 to 2^16-1 and not 2^7-1.
If you like our products and services, please help us by posting your review here.

OCAJO1
Posts: 221
Joined: Mon Nov 26, 2018 2:43 pm
Contact:

Re: [HD Pg 56, Sec. 3.1.0 - data-types-in-java]

Post by OCAJO1 »

"Notes:
1. byte, char, short, int, and, long are called integral data types because they store
integral values."

It would be nice if note 1 had a sentence added to it explaining that if all or which one of the integrals hold precise values.

Well while I'm at it, do all integral hold precise values? Or is long a trouble maker ;)

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

Re: [HD Pg 56, Sec. 3.1.0 - data-types-in-java]

Post by admin »

Integral values are, by definition, precise values. But noted.
Also, do you think you might be thinking of atomicity and not precision? Long is precise but operations on long are not atomic (a topic not on OCAJP but on OCPJP).
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

OCAJO1
Posts: 221
Joined: Mon Nov 26, 2018 2:43 pm
Contact:

Re: [HD Pg 56, Sec. 3.1.0 - data-types-in-java]

Post by OCAJO1 »

Oops good thing you said something - to keep straight precision, atomicity, volatile variables and synchronization's idiosyncrasies, I'm trying to create my own chart of what does what :roll:

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests