![]() |
The size of a data type is given by (name of datatype).SIZE. The maximum value that it can store is given by (Name of data type).MAX_VALUE. The minimum value that it can store is given by (Name of data type).MIN_VALUE.
Example: 1. If you want to print the size of float data type, use Float.SIZE 2. If you want to print the size and value of the Byte use the following code Java
Output
Byte 8 -128 127 3. To print the size, the maximum and minimum value of all primitive data type use the following code Java
Output: S.No. Data Type Size Min. Value Max. Value 1 Byte 8 -128 127 2 Short 16 -32768 32767 3 Integer 32 -2147483648 2147483647 4 Float 32 1.4E-45 3.4028235E38 5 Long 64 -9223372036854775808 9223372036854775807 6 Double 64 4.9E-324 1.7976931348623157E308 7 Character 16 |
Reffered: https://www.geeksforgeeks.org
Java |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 12 |