Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - 20 java knowledge points that students must memorize in exams.
20 java knowledge points that students must memorize in exams.
Essential knowledge of Java20

1. Writing: The written java code is saved in the source file ending with "Java".

2. Compile: Compile java source files with iavac.exe command to generate bytecode files. Format: javac source file name. Java language (a computer language, especially for creating websites)

3. Run: Use java.exe command to interpret and run bytecode files. Format: java class name

4. A java source file can declare multiple classes, but at most only one class can be declared as public, and the class name of the class declared as public must be the same as the source file name.

5 All letters in 5java keywords are lowercase.

Naming specification for names in 6. Java: package name: all letters are lowercase when multiple words are combined: xxxyyzzz class name, interface name: all words are capitalized when multiple words are combined: xxxyyzzz variable name.

7. The string belongs to a class and belongs to the dry reference data type.

8. In a class, variables declared outside methods are called member variables.

9. Variables declared in the method body are called local variables. In addition to formal parameters, local variables need to be explicitly initialized before use. (Formal parameters are also local variables)

The integer constant of 10.java defaults to int, and "'"or "l" must be added after declaring a long constant.

1 1. By default, Java's floating-point constant is double. If you declare a floating-point constant, you must add "f" or "f" after it.

12. All characters in java are encoded in Unicode, and one character can store one letter and one Chinese character, so the char type in Java is two bytes.

13. Boolean data can only take true and false values, and there is no null. You cannot use 0 or non-0 integers instead of false and true. There are no bytecode instructions dedicated to Boolean values in the java virtual machine. Java language represents the boolean value after operation, and after compilation, it is changed to the int data type in the Java virtual machine: true is represented by 1, and false is represented by 0.

14. Although the long type is 8 bytes and the float type is 4 bytes, the float type is stored by scientific counting method, so the storage range of the float type is larger than that of the long type.

15. Automatic type conversion: small-capacity types are automatically converted into large-capacity data types. Byte, short and char will not be converted to each other, and they will be converted to int type first when calculating.

16. Forced type conversion: converting a large-capacity data type into a small-capacity data type, but it may lead to a decrease in accuracy or overflow.

17. The string cannot be directly converted to the basic type, but it can be converted to the basic type through the wrapper class corresponding to the basic type.

18. The bottom of the computer stores data in the form of two's complement.

19. The original code, complement and complement of a positive number (the highest bit is 0) are the same, and the complement of a negative number (the highest bit is 1) is its complement+1.

20. Assignment operator: =+=-= * =%, and the operation result will not change the data type of the variable itself. Short I = I+1; By default, the dry constant "1" is of type int, so the compiler will report an error. Use shorti+= 1 to realize the function of+1 without changing the data type.