201671010138 2016-2017-2 "Java Programming" learning experience

Source: Internet
Author: User

The main content of this week is generics, and we have learned a little bit about generic arrays. Generic Master

Refers to the class object to be processed by the type parameter when defining classes, interfaces, and methods. A generic class is a type that has

A class of one or more variable types. A generic class can have more than one type variable, such as a class class name < generic type identity

1, generic type ID 2, ..., generic type ID 3>{...}. We need to master the implementation of the generic interface, which has two

Method of implementation:

After the generic interface definition is complete, you define the subclasses of this interface, and there are two ways to define the subclasses of the generic interface .

One is directly in the subclass after the sound of the generic type, the other is directly in the sub-class implementation of the interface explicitly given generic types.

We also learned about wildcard characters. Wildcard characters can be divided into two main categories:

(1) Match any type of wildcard character "?" Indicates that any generic object of this type can be received.

(2) Restricted generics in reference passing, you can also set the range cap for a generic object in a generic operation and

range lower limit. The upper limit of the range is declared with the extends keyword, which indicates that the parameterized type may be the specified type

declaration object: class name <? extends class > object name

Definition class: public class name < generic identity extends class >{}

Type, or the Obeject class.
Declared object: class name <? Super Class > object name
Definition class: public class name < generic identity Super class >{}

201671010138 2016-2017-2 "Java Programming" 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.