Fundamentals of OOP and Data Structures in Java is a text for an introductory course on classical data structures. Part
One of the book presents the basic principles of Object-Oriented Programming (OOP) and Graphical User Interface
(GUI) programming with Java. Part Two introduces each of the major data structures with supporting GUI-based
laboratory programs designed to reinforce the basic concepts and principles of the text. These laboratories allow the
reader to explore and experiment with the properties of each data structure. All source code for the laboratories is
available on the Web.
By integrating the principles of OOP and GUI programming, this book takes the unique path of presenting the
fundamental issues of data structures within the context of paradigms that are essential to today's professional software
developer. From the very beginning, undergraduate students will be learning practical concepts that every professional
must master during his or her career. In fact, professionals will find this book to be an excellent resource for upgrading
their knowledge of OOP, GUI programming and classical data structures. The authors assume the reader has only an
elementary understanding of Java and no experience with OOP.
Richard Wiener is Associate Professor of Computer Science at the University of Colorado at Colorado Springs and
Editor-in-Chief of The Journal of Object-Oriented Programming. He is the author or co-author of twenty-one textbooks
and professional books. In 1983 Richard Wiener received the Outstanding Teacher of the Year Award from the
University of Colorado at Colorado Springs. His areas of research include object-oriented software development,
simulated annealing and genetic algorithms, time series, and applied statistics.
Lewis J. Pinson is President of CIC and Associate Professor of Computer Science at the University of Colorado at
Colorado Springs. His areas of expertise include computer software development, object-oriented problem solving,
genetic algorithms, and complexity studies. He develops and presents training courses and intensive short courses and
workshops on object-oriented problem solving and object-oriented languages. Dr. Pinson has authored or co-authored
eight books.
Page iii
Richard Wiener
Lewis J. Pinson
PUBLISHED BY CAMBRIDGE UNIVERSITY PRESS (VIRTUAL PUBLISHING) FOR AND ON BEHALF OF THE PRESS SYNDICATE OF THE UNIVERSITY OF
CAMBRIDGE
This book is in copyright. Subject to statutory exception and to the provisions of relevant collective licensing
agreements, no reproduction of any part may take place without the written permission of Cambridge University Press.
Typeface Century Schoolbook 10/12.5 pt. and ITC Franklin Gothic System [ TB ]
A catalog record for this book is available from the British Library.
CONTENTS
1 3
Cornerstones of OOP
1.2 Encapsulation 5
1.3 Object 5
1.4 Message 6
1.5 Method 6
1.6 Class 7
1.7 Inheritance 8
1.10 Interface 17
1.11 Delegation 19
1.13 Summary 20
1.14 Exercises 21
2 22
Objects
2.6 Wrapping and Unwrapping – Conversion from Object to Scalar and Scalar to 32
Object
2.7 Strings 34
2.9 Arrays 36
2.10 Vector 40
2.11 Enumeration 44
2.12 Summary 48
2.13 Exercises 49
Page viii
3 51
Class Construction
3.3 Packages 56
3.6 Summary 62
3.7 Exercises 63
4 64
Relationships between Classes
4.1 Inheritance 64
4.2 Composition 65
4.4 Summary 75
4.5 Exercises 76
5 77
GUIs: Basic Concepts
5.4 Summary 94
6 95
Implementing Simple GUIs in Java
7 119
Errors and Exceptions
8 135
Recursion
9 157
Abstract Data Types
10 170
Containers as Abstract Data Types
11 197
Stack and Queue
Team-Fly®
Page x
12 214
Application of Stack
13 227
Lists
14 263
Trees, Heaps, and Priority Queues
15 315
Search Trees
15.1 Review of Search Table Abstraction 315
16 367
Hashing and Sets
17 395
Association and Dictionary
18 427
Sorting
Appendix A 437
Unified Modeling Language Notation
Appendix B 445
Complexity of Algorithms
Appendix C 450
Installing and Using Foundations Classes
Index 455