SCJP learning notes (1)

xiaoxiao2021-03-06  65

1. When the object is used as the parameter of the other object method, it is incorporated into the object's address, and the change caused by the re-assignment of the object internal variable in the method will actually change the role, and the parameters are The incoming object address re-assapted value is restored to the original address after the method call. When the basic type variable is the parameter of the method, only the pass value is in, and the variable is still the original value. 2. Returning the return value and the parameter of the method to cover the method to see, if it is only a change in the parameters of the method, the return value does not change, if the same name method in the subclass, the return value changes Will be compiled, prompt type is not compatible. 3. Internal class: Internal class If defined in the method of the external class, it can access all instance variables of the external class (no matter what its access control is), only the constant of the method (FINAL control) can only be accessed. In the internal class defined in the method, internal class objects must be created in the method, and the external classes can access the internal class through this method. The internal category in the method cannot be static. If the internal class in a class is static, then it will automatically upgrade to the top class, the method in the static internal class, whether it is still directly accessible, The static variable in the class can access the non-static variables in the external class after the instance of the external class object can be accessed. Accessing the internal class (non-way defined within a non-way) within the class, you can create an instance of the class () to create a category () to the NEW external class (). Static internal class creation instance. Outer.inner classname = new inner.inner (); 4. Assigning statement: First calculate the statement to the left (calculate the priority of the operator). For example: float f = 1/3; // f = 0.0float f = 1 / 3F; // f = 0.33333float f = 10; // f = 10.05. Basic type value range: CHAR class value range is 0-> 2E (16) -1, the value range of the other integer type is -2e (x) -> 2e (x) -1, no suffix integer Java default is int type, no suffix decix The default is Double type. 010 is an INT type eight-input number, 0x11 is an int type 16-en-weight number, and if the Double type can also be used 0x, 0, but the premise must have this Double type cannot be a decimal or a deciple suffix. 1 // int, 1.0 // double, 1L // (Case) LONG, 1.0F // (case) FLOAT, 6. Interface: The variables defined in all interfaces are public static final constants, Public Static Final may not be written, but must assign these constants when defined. All methods defined must be public, and public, public, can also be not written. The interface method cannot be used with Static, and the interface can be modified with AbStarct. 7. Construct Method: The constructor does not return a value, even the VOID does not have, if it has become an ordinary method. When the construction method is called, it can only be called in the first line. The constructor cannot be static. The constructor can only use three qualifiers with public, protected, private, but the constructor defined by the private cannot construct the object in other classes, and the void classname () is not a construction method, but it is an ordinary approach, it can be Among the class, class.className (); the subclass is created in the subclass, and the non-arranging configuration method of the parent class is first called.

转载请注明原文地址:https://www.9cbs.com/read-88789.html

New Post(0)