The
1 Public classEqualsmethod2 {3 Public Static voidMain (string[] args)4 {5Integer N1 =NewInteger (47);6Integer N2 =NewInteger (47);7System.out.print (N1 = =n2);8System.out.print (",");9SYSTEM.OUT.PRINTLN (N1! =n2);Ten } One}
Output Result:
False,true
Note: Use integer a = 1, or integer a = integer.valueof (1), or a value between 128 and 127 as the base type. Use integer a = new integer (1), regardless of the value, as the object. No.2
1 class parent{2public float afun (floatfloat b) {}}class child extends parent{ 5
6}
It is not legal to insert any of the following methods into row 5. ( )
A. float afun (float A, float b) {}b. publicint afun (intint b) {}c. publicfloat afun (float p, float q) {}d. privateint afun (int A, int b) {}
Answer: A
Note: Method overrides should follow the "three same small One big" principle: "Three identical": that is, the method name is the same, the formal parameter list is the same, the return value type is the same; "A small": a subclass method declaration throws an exception that is smaller or equal than the exception thrown by the parent method declaration; the access adornment of the subclass method Fu Chingbi The parent class method is larger or equal.
No.3
For thread-local storage of TLS (thread local storage), the following statements are correct:
Answer: ABD
Note:
five basic principles of object-orientedSingle Responsibility principle (SRP)
Open Closure principle (OCP)
Richter Replacement principle (LSP)
dependency Inversion principle (DIP)
Interface Isolation principle (ISP)
Java Brush title Diary 2018-08-01