Summary of java knowledge points

1. Basic data type

Shaping:

Byte 1 byte

Short 2 bytes

Int 4 bytes

Long 8 bytes

Character:

Char 2 bytes

Floating point number:

Float 4 bytes

Double 8 bytes

Boolean:

Boolean 1 byte

2.7 adding binary integers

Start with 0b or 0b

3. The 16 bit Unicode encoding method for characters in Java. The format is' \ uxxxx ', where XXXX represents a hexadecimal integer

4. Java specifies positive infinity, negative infinity and zero

Positive infinity = a positive number divided by 0

Negative infinity = a negative number divided by zero

Divide 0.0 by 0.0 or square a negative number to get a non number

5. In Java, Boolean types can only be true and false

6. There is no multidimensional array in Java

It seems that the multidimensional array in C language is not a real array. For example, a [3] [4], a [0], a [1] and a [2] are real. They are loaded with addresses, which is the same as the array dynamically allocated in C language

int [][] b = new int[3][4]

7. Compilation method with package in Java

javac -d . Hello. Java will generate a directory tree under the current directory

Run java package name Class name

8. The filed of the object in Java polymorphism is not polymorphic. For example, the parent class object = new subclass (), and the object. Field is the parent class of the call, even if the field is overwritten in the subclass.

9. Instanceof operator

Format: refers to the variable name instanceof class name (or interface). It is used to judge whether the previous object is the class, subclass and implementation class instance of the following object. It returns true or false

10. Conversion between basic data types and corresponding encapsulation classes in Java

int a = 1; Integer A = new Integer(a); a = A.intValue();

The same is true for other types.

11. Singleton class examples

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>