201671010109 2016-2017-2 "Java Program Design" Tenth Week learning experience

Source: Internet
Author: User

This week we learned about generic programming, which allows us to write code that is reused by many different types of objects. A generic class is a class that has one or more type variables. We can define generic classes, or we can define generic methods, which can be defined in ordinary classes and generic methods. The invocation of a generic method is to put a specific type in the angle brackets before the method name.

Type variables are qualified, <t extends A>t can bind classes or interfaces, a type variable or wildcard can have more than one qualification, with & connection.

Wildcard characters are not type variables, and when a wildcard is caught, the compiler must be able to be sure that the wildcard expression is a single, deterministic type. Unqualified wildcard characters, such as pair<? > But it's different from the original pair.

201671010109 2016-2017-2 "Java Program Design" Tenth Week learning experience

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.