: Primitive DataTypes in Java

4 views3 pages

Document Summary

Integer values are: i. byte: this type takes up 1 byte of memory and stores values ranging from -128 to +127. Ideal for storing score in an exam or age of humans. The default value assigned to byte is 0. Examples are byte score or byte age. ii. short: this type takes up 2 bytes of memory and stores values ranging from -32768 to +32767. Ideal for storing number of employees in a large organisation or students in a learning institution. The default value assigned to short is: examples are short employeenum or short studentpopulation. iii. int: this type takes up 4 bytes of memory and store values ranging from -2,147,483,648 to +2,147,483,647. Ideal for storing the population of a country or units produced in factory. The int data type is default integral type. The default value assigned to int is 0.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions