23.3. Bubble Sort

 
[Page 693]

Chapter 21. Generics

Mayan God Shel, Mexico. Photographer: Philip Coblentz. Courtesy Brand X Pictures.

Objectives

  • To use generic classes and interfaces ( §21.2).

  • To declare generic classes and interfaces ( §21.3).

  • To understand why generic types can improve reliability and readability ( §21.3).

  • To declare and use generic methods and bounded generic types ( §21.4).

  • To use raw types for backward compatibility ( §21.5).

  • To know wildcard types and understand why they are necessary ( §21.6).

  • To understand that all instances of a generic class share the same runtime class file ( §21.7).

  • To convert legacy code using JDK 1.5 generics ( §21.8).

  • (Optional) To design and implement a generic matrix class ( §21.9).


[Page 694]

21.1. Introduction

Generics is the capability to parameterize types. You can declare a generic type in a class, interface, or method and specify a concrete type when using the class, interface, or method.

This chapter introduces how to declare and use generic classes, interfaces, and methods, and demonstrates how generics can be used to improve software reliability and readability. This chapter can be intertwined with Chapter 10, "Abstract Classes and Interfaces."

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net