- Details
- Written by Nam Ha Minh
- Last Updated on 18 August 2019   |   Print Email
Data types are cornerstones of a programming language. The Java language has 8 primitive types:
boolean,
byte,
char,
double,
float,
int,
long, and
short.A
boolean type represents either
true or
false value.A
char type represents a single character, such as 'a', 'B', 'c', ...Actually char type is 16-bit integer number (un-signed).The others are numeric types. The following section lists the primitive types which represent numbers in the Java language (the char type is also included because it is actually a number type):
Integer numbers:minimum value: -128 (-27)
maximum value: 127 (27-1)
minimum value: 0
maximum value: 65,535
minimum value: -32,768 (-215)
maximum value: 32,767 (215-1)
minimum value: -2,147,483,648 (-231)
maximum value: 2,147,483,647 (231-1)
minimum value: approx. -9,2 billions of billion (-263)
maximum value: approx. 9,2 billions of billion (-263-1)
Floating-point numbers:- float: 32 bit (4 bytes):
- double: 64 bit (8 bytes):
There are 4 integer types:
byte,
short,
int, and
long.There are 2 floating point number types:
float and
double.
Related Tutorials: Other Recommended Tutorials:
About the Author:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on
Facebook and watch
his Java videos you YouTube.