Java Brush title Diary 2018-08-01

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.