
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of Java primitive data types, their storage and range of values, variable declaration and assignment, and expression evaluation. It covers the different categories of data in Java, the eight primitive data types, and their corresponding literals. The document also explains the concept of variables, their declaration and initialization, and the use of assignment statements and expressions.
Typology: Study notes
1 / 24
This page cannot be seen from the preview
Don't miss anything!
Type Description Example of Literals int integers (whole numbers) 42 , 60634 , -8, 0 double real numbers 0.039, -10.2, 4.2E+ char single characters 'a', 'B', '&', '6' boolean logical values true, false
Type Storage Range of Values byte 8 bits -128 to 127 short 16 bits -32,768 to 32, int 32 bits -2,147,483,648 to 2,147,483, long 64 bits -9x 18 to 9x 18 float 32 bits ± 10
to ± 10 308 , 15 significant digits
int numDimes; double length; char courseSection; boolean done; String lastName;
int numDimes = 4; double length = 52.3; char courseSection = 'J'; boolean done = true; String lastName = "Reid-Miller"; int count = 3 + 2;
int a = 40; double x = 40.0; int b = 6; double y = 6.0; int c; double z; c = a / b; 6 c = a % b; 4 z = x / y; 6.66666667 c = b % a; 6 c = b / a; 0 c = 0 % a; 0 z = y / x; 0.15 c = b % 0; error c = 0 / a; 6 c = a / 0; error