Experience and Tij note 50

xiaoxiao2021-03-06  18

Experience and Tij notes (original)

1.Overridden (overwriting also overwriting) rule 1). The return type must be the same as the rendered method). You cannot access the ability to access the way 3). You cannot throw more exceptions than the rewriting method. Finally unique situation is system.exit () 3. Access Public> Protected> Private> Private4. Abstract method in the abstract class 5.Transient can only be used for member variables, and cannot be used for local variables. You cannot use 6.Volatile with Final, Static, which can be used for variables and for constants, and variables may be modified asynchronously because threads may be modified asynchronous modifications. 7. The garbage collection is at a lower priority, used to release system resources, rather than memory, calling the Finalize method for the father class when calling, is not necessarily a pair, and the data member is automatically used for public, static. Final; function is automatically used for public, abstract but cannot be static; so after inheriting functions, you must write public10.nan can't use the Equals method to determine 11.void class is a parcel class of VoID data type, cannot be instantiated, just one Placeholder. 12. Java's octave data does not overflow. Maximum plasticity 1 get a minimum. 13. There are three types of shifting characters: >>, <<, >>> (notice that there is no <<<) left shift operator cycle, such as 1 << 32 equivalent to 1 << 0 = 1, because 32% 32 = 014. The memory is divided into code area, data area, stacking area, stack area, and garbage recovery can be managed to be limited to the pile area. 15. Object existence into two parts: References and references pointed out in memory block 16. All functions in the String class have such features: Generate a string backup when modified to strings, and implement strings in the backup Modify, and the original string object remains unchanged. Changing the string principle is that if you have not changed, return to the original string, otherwise a new string object is generated. 17.1) In the class Object, the equals method is compared to == having the same effect 2) is not class Object, rewriting the function Equals in the Object class, call according to the polymorphism, and the type of comparison, ie comparison type and content. Rewriting Equals

String, Integer, Double, Date, File18.Switch After the expression type, the specified array length must be one of Byte, Short, Char, Int, 19. Create and initialization as follows: 1) Assign storage space and default initialization 2) Recursive uses the following steps, the instance variable initialization I) Binding constructor parameter II) In the constructor, if there is a THIS statement, recursive, jump to V) III) Recursively perform display or implicit SUPER () Statements, until Object Sail IV) Perform explicit initialization statement V) Perform the current constructor in the current constructor

Recursive: Compiling formula interpreters When analyzing, perform a New operator, repeat I) ~ V) this (): other constructor call statement 20 in the same class is always "executing in the same class. "Call, first execute the parent class construction 21." The ability to mask the variables in larger living space "in C / C ," Java is not available. 22. Full-white Final: If the initialization does not occur at the definition, it must be initialized in the constructor. 23. The principle of constructor: Simply enable objects as possible to enter the normal state, if possible, don't call any function, the only function in the constructor can securely call the FINAL function in the class. 24. Please inherit the difference in the expression behavior, and the changes in the state of the data member are expressed. 25. Wait can only be called in the Synchronized function or synchronization section, and Wait and Notify are called in the non-synchronized function, and the exception is received.

Sleep, Suspend, Resume can be called. Wait is an example method, Sleep, Yield is a static method. 26. Calences cannot be placed in an interface, but static internal classes can be part of the interface. 27. You can use Static Inner Class to control your test code, run: Peripheral name $ Internal class name 28. The character encodes in the ASCII code in the NNICODE. 29. In the floating point operation, the NAN will appear, the division operation will appear infinity30.Vector two adding element methods add and addElement31.String and StringBuffer objects. 32. Static segment in the class cannot be throw33. If you use the synchronized to modify the Static method, Static writes in front, that is, Static Synchronized34. One yuan operator will increase to int35. Cannot assger value for the Boolean variable nan! = Nan is only when Nan! = Nan is True37.-EA is equivalent to -ENABLEASSERTIONS (plural) 38. The second expression of 38.Ssert must be an expression, can't be a VOID function 39.main can be declared as Final40. For a non-NULL reference aaequals (null) Return False41 . SQRT (parameter) If the parameter is NAN or less than zero, the result is nan42. Array can be defined into int [] count = null; int a [] = new int] ^^ This situation here No value 43. Unlike the internal classes of the class one, the local class is executed in order, so you cannot create an instance of a class before defining. 44. Local variables cannot be modified by static. 45.1. Class Parent {2. Private void method1 () {system.out.println ("parent's method1");} 3. Public void method2 () {system.out.println ("Parent's Method2"); method1 (); } 4.} 5. Public class child extends parent {6. Public void method1 () {system.out.println ("Child's method1");} 7. // public void method2 () {system.out.println (" Child's method1 "); method1 ();} 8. Public static void main (string args []) {9. Parent p = new child (); 10. P.Method2 (); 11.} 12.} The result is: Parent's method2 Parent's method1 analysis: 1) If you change the private of the second line to PUBLIC, the result is Parent's Method2 Child's method1 2) If you remove the gaze symbol of the 7th line, the result is Child's method2 child's method1 3) 3 row memo is released, the compilation error will occur.

Related Knowledge: The first group 1). If the subclass covers the method of the parent class, then the sub-class object calls the method, the variable of the class modified by this method is the variable of the subclass. 2). If the subclass does not cover the method of the parent class, then call the parent class directly, the variable of the class modified by the method is the variable of the parent class. The second group 1). In the default, the object can only call the parent class method and the parent class variable (the method of calling subclasses will be compiled). There are two different situations: i) The calling method is a method covered by the subclass. At this time, the parent class variable is the II that cannot be modified by this method is a method that is not covered by the subclass. At this time, the parent class variable can be modified by this method 2). Mandatory type Under the conversion, the object can only call its sub-class method and subclass variable, there are two different cases I) Forced converting II when calling methods) Call variables, 46.Vector and havehtable are threads Safe 47. When running with an asserted program, if you have a package name or class name, you indicate this class or package. If there are three points after the package name, represent this package and its sub-package. If there is only three points, it is said that there is no name package. 48. If the class in the reference type does not define this member, and the same name member is defined in the subclass, the compile will be reported, that is, the parent class reference cannot access the subclass append member. 49.Collection --- set | --- list --- linkedlist | --- arraylist | --- vector --- stackmap --- haShtable | --- hashmap | --- weakhashmap summary: 1). Involved To the stack, queue operation, consider using LIST. For quick plug, delete elements should use LinkedList. To quickly random access, use ArrayList2). If the program is in a single threaded environment, or access is only in one thread, consider the class of efficiency, such as multi-thread simultaneously, use synchronization classes. 3). Pay special attention to the hash table, as a key to Key to properly overwrite the Equals and HashCode4). Try to return the interface instead of the actual variable, if returning List is not arraylist, so if you need arraylist to change. 5) .hashmap and havehtable difference: i) .hashtable is the only class II that implements Thread-Safe in Map) .hashmap allows null as Key or Value, HashTable is not allowed, will throw an empty pointer exception. III) .hashmap removes the Hashtable's Contains method, change to ContainSvalue and Containskey. Because the Contains method is easy to misunderstand. 50. Byte, Double, Float, Integer, Long, Short inherits from Number, Some public methods such as IntValue; Charater, Boolean inherits from Object

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

New Post(0)