integral type: Basic data type in Java byte, occupies 1 bytes, 8-bit range: 0000 0000 ~ 1111 1111 (-128 ~ 127) Why not: 0000 0000 ~ 1111 1111? In the actual programming language (a language), divided into signed, with unsigned, the highest bit is 1 o'clock negative, the highest bit is 0 the highest bit is the sign bit, the positive sign bit 0, the negative number is 1 1111 1111 represents the maximum of negative numbers:-1 negative binary = positive (absolute value of the number) binary inverse Code + 1. the largest positive number is 0 1111111, which is 2^0+2^1+......+2^6=127; the smallest negative number, the same as 1 1111111, or 127. There is a problem with the above description, that is 0, there will be a +0 and a-0. So the 0 is 128, which is the perfect combination of the complement of the computer (the program is perfectly set to run in the same order) . and so on, Int,short,long can launch their range of values.
Second, floating-point type:: Both float and double need to be marked separately. For example: float f = 123.45f;double d = 123.45D;
Three, character type: Char is a single character enclosed by single quotation marks, and is compatible with int. For example, make the following statement:
int a = ' a ';//a =97
char c =65;//c = ' A '
Four: Boolean (Logical): Boolean has only two states, which is "true" and "false".
Boolean t = True;//1 for true, logical true
T = false;//0 indicates false, logical false
Basic Java data types