Interview Preparation & Summary-java basic article

Source: Internet
Author: User

The server on the VPS expires, and the HW is inaccessible, writing notes directly in the blog park.

Basic Article

1. The inheritance relationship of the collection class, the source code implementation principle, the initial size and how to grow.

-The list class has an initial size of 10, a load factor of 1, and an expansion to 1.5+1. The underlying is an object array called System.arraycopy for copying.

-Vector Ibid, the expansion factor is twice times, is synchronous, thread-safe.

-HashMap Initial size 16, load factor 0.75f, expansion to twice times. The bottom layer is the array + linked list, which calls resize () to adjust the position.

-Hashtable Initial size 11, load factor 0.75f, expansion to twice times +1. Thread-safe with segmented locks.

-TreeMap. The bottom red and black tree, can keep orderly, the efficiency is slightly low.

Specifying a size can improve performance. You may also ask the usual methods in collections and arrays.

2. The difference between interface and abstract class

-Interfaces can be implemented multiple, and abstract classes cannot be inherited multiple.

-abstract class can have attribute, interface can only have method.

-the method of an interface must not be implemented, and an abstract class can have an implementation method.

-the method in the interface is default and must be public , and the abstract class can be protected.

3. Instantiate a process for a class that has not been loaded.

See the book.

4. Error errors and exception exception classification, throws and throw differences.

Java exceptions (including exception and error) are divided into checked exceptions and unchecked exceptions:

-checked Exceptions: Other than RuntimeException and its subclasses, the exception class and its subclasses. The Java compiler examines it and forces the processing to be required.

-unchecked Exceptions: Includes run-time exceptions (RuntimeException with its subclasses) and errors (error).

What are the 5.Object methods?

-tostring,hashcode,equals

-clone,finalize,getclass

-wait,notify,notifyall

6. = =, equals, hashcode relations. It is possible to match a string to ask, possibly with set ask.

Interview Preparation & Summary-java basic article

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.