Java basic type and reference type
Java basic types include byte, short (not used), int, long, float (less used), double, char, boolean (either false or true)
A boolean example is as follows:
Int A = 3; if (A> 2) // the value of A> 2 is true, so if (1) System cannot be written like this. out. println ("awesome"); elseSystem. out. println ("silly"); the following if is the most direct if (true) System. out. println ("awesome"); elseSystem. out. println ("stupid ");
An interesting calculation question:
int a=5;int b=a++ + ++a + ++a + a++;System.out.println(b);//28(5+7+8+8)
The minimum and maximum values of the java basic type (raw data type) are calculated as follows:
System. out. println ("minimum byte value:" + Byte. MIN_VALUE); System. out. println ("Maximum byte:" + Byte. MAX_VALUE); System. out. println ("short minimum value:" + Short. MIN_VALUE); System. out. println ("short maximum value:" + Short. MAX_VALUE); System. out. println ("int minimum value:" + Integer. MIN_VALUE); System. out. println ("int maximum value:" + Integer. MAX_VALUE); System. out. println ("long minimum value:" + Long. MIN_VALUE); System. out. println ("long maximum value:" + Long. MAX_VALUE );
The values of the corresponding basic types are as follows:
The referenced data types of java include classes, arrays, and interfaces. For example, String is a class.
The following is an answer from Baidu Zhili:
Java data type diagram: Numeric numeric INTEGER: byte short int long numeric Basic Data Type Linear Regression regression floating point: float double linear regression: char data type: boolean argument class (class) argument references the argument interface (interface) argument array (array) java data types include basic data types (original data types) and reference data types. 1. the figure clearly shows the eight main types of data variables. After such data variables are declared, java will immediately allocate memory space to them. For example: short a; java will find a block that occupies two bytes in the available memory space to the variable; 2. the three data types referenced are similar to the C/C ++ pointer. It points to the object (specific value) in a special way. memory is not allocated when such variables are declared, only a memory address is stored. You just need to know the data structure. Generally speaking, I. Remember that it is enough. II. Memory and address are basically reference rather than basic. 3. You can understand the memory address as your student ID, the object entity is you. Every time you find your student ID, this is reference. The application of this knowledge point: 1. "=" is used between the referenced data types to determine whether the memory address is equal and to determine whether the content entity uses equals. 2. The basic value is used to transmit a copy of the parameter, the original value remains unchanged after modification. The address is used to reference the passed value parameter. The original value is changed after modification.