0% found this document useful (0 votes)
2 views

Java Variable Sizes

The document outlines the sizes and ranges of various Java data types. It details that byte, short, int, long, float, double, boolean, and char have specific byte sizes and value ranges. For example, a byte occupies 1 byte and ranges from -128 to 127, while a double occupies 8 bytes and can store up to 15 decimal digits.

Uploaded by

finanej937
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Java Variable Sizes

The document outlines the sizes and ranges of various Java data types. It details that byte, short, int, long, float, double, boolean, and char have specific byte sizes and value ranges. For example, a byte occupies 1 byte and ranges from -128 to 127, while a double occupies 8 bytes and can store up to 15 decimal digits.

Uploaded by

finanej937
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Java variable sizes

1. byte: Occupies 1 byte and stores whole numbers from -128 to

1271.

2. short: Requires 2 bytes and holds whole numbers from -32,768 to

32,7671.

3. int: Takes up 4 bytes and stores whole numbers from -

2,147,483,648 to 2,147,483,6471.

4. long: Utilizes 8 bytes and accommodates whole numbers from -

9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 1.

5. float: Requires 4 bytes and stores fractional numbers. It’s sufficient

for storing 6 to 7 decimal digits1.

6. double: Occupies 8 bytes and also stores fractional numbers. It’s

sufficient for storing 15 decimal digits1.

7. boolean: Consumes 1 bit and stores true or false values1.

8. char: Takes up 2 bytes and stores a single character or ASCII

values1.

You might also like