[HD Pg 56, Sec. 3.1.0 - data-types-in-java]
Moderators: Site Manager, fjwalraven
-
- Posts: 21
- Joined: Mon Nov 20, 2017 8:00 am
- Contact:
[HD Pg 56, Sec. 3.1.0 - data-types-in-java]
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?
-
- Site Admin
- Posts: 10070
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 56, Sec. 3.1.0 - data-types-in-java]
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.
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: [HD Pg 56, Sec. 3.1.0 - data-types-in-java]
"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
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
-
- Site Admin
- Posts: 10070
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 56, Sec. 3.1.0 - data-types-in-java]
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!
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.
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: [HD Pg 56, Sec. 3.1.0 - data-types-in-java]
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
Who is online
Users browsing this forum: No registered users and 96 guests