About some design patterns (interview minor questions, Java chapter) __java

Source: Internet
Author: User

Today in a company (not disclosed) wrote a set of Java face questions. There is a question about this.

Which design pattern used in Java.lang.Runtime?

So what design pattern is used in the java.lang.Runtime?

And what design patterns are used in java.utils.collection.

At that time because of this unpopular knowledge not enough, and the API also read less, so a short answer.

back home and searched the next.

For:

Runtiome.

Single case mode.

1 each Java program has a single instance of the runtime class.

2 Obtain an instance of the runtime class by Runtime.getruntime ().

3) The runtime class is an example of using a single example pattern.

Collection.

Adorner mode.

For example:

ArrayList Package Builder

Public ArrayList (collection<? extends e> c) {...}

LinkedList Package Builder

Public LinkedList (collection<? extends e> c) {...}

HashSet Packaging builder Publichashset (collection<? extends e> c) {...}


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.