![]() ![]() ![]() |
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
This section shows you the main components of a class by using a small example that implements a stack a data structure whose items are added and removed in a last-in-first-out (LIFO) fashion. The following figure shows theStack
class and identifies the elements of a class.
The
Stack
ClassA class declaration first names the class, then specifies its superclasses and any interfaces it implements, followed by the class body. The next section, Declaring Classes
Note:java.util.List
andjava.util.ArrayList
are generic types and require a type argument when used. The type argument is given in angle brackets (<Object>
). For more information on generic types, see Generics.
covers the elements of a class declaration.
![]() ![]() ![]() |
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.