Basic data types integer types: byte , Short , int , Long Float type: a float , Double character type: char boolean: boolean computer memory storage unit is the smallest byte ( byte ) i.e. 8-bit binary byte ---> . 1 Short / char ---> 2 int / a float ---> . 4 Long / Double ---> . 8 integers in the range: byte : - 128 ~ 127 Short : - 32768~ 32767 int : - 2147483648 ~ 2147483647 Long : - 9223372036854775808 ~ 9223372036854775807 floating-point number is a decimal floating-point type, since when expressed in scientific notation of decimal, the decimal point can be "floating". As can be represented 1234.5 12.345x10², it can be expressed as 1.2345x10³, so called float. For float type, we need to add the suffix f. The float type can represent the largest 3.4x10³⁸, and double type can represent the largest 1.79x10³⁰⁸ Boolean boolean type boolean only true and false two values. B1 Boolean = to true ; Boolean B2 = to false ; Boolean isGreater = . 5 > . 3 ; //Evaluates to true int Age = 12 ; boolean isAdult = Age> = 18 ; // evaluates to false the Java stored on boolean and regulations do not, because theoretically store boolean needs only 1 bit, but will generally JVM internal boolean It represents an integer of 4 bytes. Character type character type char represents a character. Java char type addition may represent a standard ASCII, it may also represent a Unicode character: public class the Main { public static void main (String [] args) { char A = ' A ' ; char ZH = ' in ' ; the System. OUT .println (A); the System. OUT.println (ZH); } } ! Note: char type uses single quotes ' , and only one character, and double quotation marks to "string type to distinguish. Constants defined variable, if coupled with the final modifier, this variable becomes a constant: final Double = PI 3.14 ; // PI is a constant constants can not be reassigned after initialization when defining assignment again causes a compilation error. according to custom, the constant name is usually all uppercase. var keyword in some cases, the type name is too long, write more trouble for example:. the StringBuilder STRB = new new the StringBuilder (); this time, if you want to omit the variable type, the keyword may be used var var STRB = new new the StringBuilder (); compiler will automatically recognize STRB as new new the StringBuilder (). * scope variables In Java, a multi-line statements enclosed by {}, constituting statement block, the compiler may identify the beginning and end of a block of statements. And the variable defined in the statement block, which has a scope that is defined from the beginning to the end of the block. Beyond the scope of these variables are referenced, the compiler will complain. And the definition of variables, to be followed to minimize the scope of the principle, try to variables defined in the scope as small as possible, and do not reuse variable names. { ... int i = 0 ; // variable i defined starting here ... { ... int x = . 1 ; // variable x here defined starting ... { ... String S = " Hello " ; // variable s from here defines ... } // variables s scope to this end ... @Note that this is a new variable s, and above it the same name as a variable, // but because of different scopes, they are two different variables: String s = " Hi " ; ... } // variables x and s this concludes the scope ... } // variable i scope of this junction