1. Definition Format of Java constants: final variable type variable = initialization, for example, final double Pi = 3.14;
2. In addition to the addition function, "+" also connects to form a new string by adding the string to other data types.
3. if the number of shifted digits exceeds the size of the number of digits that can be expressed by the Data Type of the left operand, the right operand should first perform the modulo (%) on the Type length of the left operand ), then shift with the result of the modulo operation.
For example, int v = 5; system. out. println ("V> 33" + (V> 33); equivalent to carrying out a shift of 33% 32, that is, V> 1 = 2;
4. create an array: first declare int A []; then allocate memory to create an array A = new int [5]; in actual programming, the syntax format is usually written together: type arrayname [] = new type [length]; or
Type [] arrayname = new type [length];
5. Evaluate the array length: array name. length.
6. Advanced Operations of the array class
7. foreach statement: For (data type variable: Set) {statement ;}
8. Create a two-dimensional array: int A [] []; A = new int [2] [3]; indicates that there are two 3-dimensional arrays. A. Length = 2; A [0]. Length = 3; A [1]. Length = 3;
9. In Java, string STR = ""; indicates an empty string, but the system has allocated memory space. String STR = NULL; the system does not allocate memory for it;
10. Once a string is successfully created, its value will not be changed. No matter whether you perform any operation on the string, you are not modifying the value of the original string, but generating a new string instance.
11. string is an object, so it has methods, equals, length, search and comparison. The length of the array uses the length of the array, evaluate the length of a string by using its method length ();
12. The member method must have a return type and a return value. If the return type of the method is void, the return value of the method is null. Therefore, you do not need to write a return statement in the method body.
13. the default modifier is not needed. A Class modified by the default modifier is visible in its package (whether it is other classes in the same package or its own subclass, this class is invisible in other packages.
14. To achieve good encapsulation, the class member variables need to be defined as private, and the member variables cannot be accessed outside the world.
15. Functions of New when an object is created: 1. allocate memory to it in the heap to create an object; 2. Call the class constructor.
16. In Java, static members form objects in the heap only when the class is loaded, and no new objects are formed later. You can use the "class name. you cannot directly access the instance variables and instance methods of the class you are using to call static methods ), because static methods are only associated with classes and objects, they are not directly associated.
17. This keyword cannot be used in static methods. Because this is within the scope of the object, the static method is only related to the class.
18. parameter transfer for reference data type refers to the transfer of a copy of the handle each time the real parameter (handle) is passed. This copy is the address of the parameter. If the address of this copy is not changed in the method, but the value of this address in the memory is changed, the change in the method will affect the value of the real parameter; if the handle value of the copy is changed in the method (for example, a new address is generated using the new operator), the original value of the real parameter is not affected.
19. When the member variable name and the constructor parameter name are not duplicated, this keyword can be omitted.
20. Subclass can inherit all the member variables and member methods of the parent class, but it cannot inherit the member variables and methods with private access permissions in the parent class, nor can it inherit the constructor of the parent class. Java only supports single-element inheritance. Multi-Element inheritance is not allowed. That is, a subclass can only have one parent class. Two or more parent classes are not allowed, but can have multi-layer inheritance.
21. abstract class: a class that declares a method but does not implement it is called an abstract class. It is used to create a class that reflects certain behaviors and declares a method for this class, but cannot implement this class, abstract classes are generally used to implement polymorphism, but cannot be instantiated. They can only be inherited and cannot have abstract constructors or abstract static methods. You can define non-abstract methods in an abstract class, that is to say, not only abstract methods exist in the abstract class.
22. an interface is a set of constants and Methods. Only the features of a method in an interface do not implement a method. In essence, an interface is a special abstract class, the field access permission in the interface is public final by default, and the method in the interface is public abstract by default.
23. The class implementing the interface must implement all the methods defined in the interface, except the abstract class.
24. external classes cannot directly use members of internal classes, but internal classes can directly use any resources of external classes (including private resources). The this pointer of internal classes points to internal references of internal classes, if you want to use the this pointer to use external members, you can use the "external class name. this. external class members.
25. exception is the parent class of all checked exception classes. Throws statement processing exceptions refer to statements that generate exceptions in this method and are not processed in this method, instead, it is handed over to the upper-level method for handling.
26. The equals () method of the common reference variable compares the object address, but the EQUAL () method of the reference variable in the automatic packing method compares the object content.