
Object-Oriented Programming With Java / Edition 2
by Barry Holmes, Daniel T. JoyceISBN-10: 0763714356
ISBN-13: 9780763714352
Pub. Date: 10/04/2000
Publisher: Jones & Bartlett Learning
Object-Oriented Programming with Java was developed for students in the science, engineering, and business fields where knowledge of programming is thought to be essential. This text, on modern software development, contains material that is typically covered in a CS1 course. In addition to traditional introductory programming concepts, object-oriented concepts and
Overview
Object-Oriented Programming with Java was developed for students in the science, engineering, and business fields where knowledge of programming is thought to be essential. This text, on modern software development, contains material that is typically covered in a CS1 course. In addition to traditional introductory programming concepts, object-oriented concepts and techniques such as inheritance and polymorphism are presented in a student-friendly manner. Java-related topics such as exception handling and the Java I/O models are carefully treated, and an entire chapter is devoted to Java applets.
Product Details
- ISBN-13:
- 9780763714352
- Publisher:
- Jones & Bartlett Learning
- Publication date:
- 10/04/2000
- Edition description:
- 2E
- Pages:
- 608
- Product dimensions:
- 7.44(w) x 9.26(h) x 1.15(d)
Table of Contents
Chapter 0 | Introduction | 1 |
0.1 | What is Java? | 2 |
0.2 | Using the Internet | 3 |
0.3 | Downloading the Java 2 SDK for Windows, Unix (Solaris), and Linux Users | 4 |
0.4 | Downloading Java 2 SDK Documentation | 4 |
0.5 | Creating a Java Software Development Environment | 5 |
0.6 | Copying and Installing the Audio-Visual Interface (AVI) | 7 |
0.7 | How to Input and Save a Java Program in the Computer | 9 |
0.8 | How to Compile a Java Program | 10 |
0.9 | How to Execute (run) a Java Program | 12 |
0.10 | SDK Tools | 14 |
0.11 | Copying and Editing Programs from the CD | 15 |
Summary | 17 | |
Chapter 1 | Primitive Data Types and Arithmetic | 19 |
1.1 | Data | 20 |
1.2 | Data Storage | 21 |
Number Systems | 23 | |
1.3 | Identifiers | 27 |
1.4 | Syntax | 29 |
1.5 | Variables and Constants | 31 |
1.6 | The Format of a Simple Program | 33 |
1.7 | Arithmetic | 35 |
Unary Operators | 35 | |
Binary Multiplicative Operators | 35 | |
Binary Additive Operators | 35 | |
1.8 | Operator Precedence | 40 |
1.9 | Casting | 42 |
Summary | 45 | |
Review Questions | 46 | |
Exercises | 47 | |
Programming Problems | 49 | |
Chapter 2 | Objects | 51 |
2.1 | Introduction to Objects | 52 |
2.2 | The String Class | 53 |
Declaring Objects | 54 | |
Methods and Parameters | 54 | |
Constructors | 56 | |
String Assignment | 58 | |
Instance Methods | 58 | |
2.3 | The Anatomy of a Simple Program Revisited | 61 |
Heading Giving Details of the Name and Purpose of the Program | 62 | |
Import List | 62 | |
Class Name | 63 | |
Main Method | 63 | |
2.4 | The AVI Package | 63 |
2.5 | The Window Class | 65 |
2.6 | Input to a Dialog Box | 69 |
2.7 | Converting Strings to Numbers | 72 |
2.8 | Command Line Arguments | 75 |
2.9 | Errors | 78 |
Syntax Errors | 78 | |
Run-Time Errors | 82 | |
Logical Errors | 82 | |
Summary | 82 | |
Review Questions | 83 | |
Exercises | 84 | |
Programming Problems | 85 | |
Chapter 3 | Object-Oriented Programming | 87 |
3.1 | Abstract Data Type | 88 |
3.2 | Constructors | 90 |
3.3 | Instance Methods | 93 |
3.4 | Class Methods | 101 |
3.5 | Scope and Lifetime of Identifiers | 104 |
3.6 | Software Development | 106 |
3.7 | Object-Oriented Program Design | 108 |
Identify the Classes and Methods | 109 | |
Algorithm Development | 111 | |
Testing | 112 | |
Compilation and Execution | 112 | |
Documentation | 113 | |
Case Study: Cutting Logs | 116 | |
3.8 | The AVI Package Revisited | 124 |
The Audio Class | 125 | |
The Timer Class | 128 | |
The Filmstrip Class | 130 | |
Case Study: A Simulation of Rolling a Die | 135 | |
Summary | 144 | |
Review Questions | 146 | |
Exercises | 147 | |
Programming Problems | 150 | |
Chapter 4 | Selection | 153 |
4.1 | More AVI Classes | 154 |
The Slider Class | 154 | |
The RadioButtons Class | 156 | |
4.2 | If..else Statement | 161 |
4.3 | Nested If Statement | 166 |
4.4 | Conditional Expressions | 172 |
4.5 | Else if Statements | 176 |
4.6 | Boolean Data Type | 177 |
4.7 | Switch | 179 |
4.8 | Wrapper Classes | 184 |
Case Study: Body Mass Index | 185 | |
4.9 | Yet another AVI Class! | 194 |
The Memo Class | 194 | |
4.10 | The This Object | 195 |
Case Study: Validation of Dates including Leap Years | 196 | |
Summary | 209 | |
Review Questions | 210 | |
Exercises | 210 | |
Programming Problems | 212 | |
Chapter 5 | Repetition and One-Dimensional Arrays | 217 |
5.1 | Loop Structure | 218 |
5.2 | While Loop | 220 |
While Loop Controlled by a Counter | 220 | |
While Loop Controlled by Data | 220 | |
5.3 | Do..while Loop | 227 |
5.4 | Increment/Decrement Operators | 232 |
5.5 | For Loop | 235 |
5.6 | Which Loop? | 239 |
while | 240 | |
do..while | 240 | |
for | 240 | |
5.7 | Arrays Revisited | 241 |
5.8 | Declaring and Initializing One-Dimensional Arrays | 242 |
Three Methods | 242 | |
5.9 | Using Arrays | 245 |
Case Study: Palindrome | 253 | |
5.10 | Our Last AVI Class: CheckBoxes | 261 |
The CheckBox Class | 261 | |
5.11 | Formatting Numbers for Output | 264 |
Case Study: Ben's Breakfast Bar | 267 | |
Summary | 282 | |
Review Questions | 283 | |
Exercises | 283 | |
Programming Problems | 285 | |
Chapter 6 | Advanced Concepts with Classes | 289 |
6.1 | Inheritance | 290 |
6.2 | An Example of Inheritance | 292 |
6.3 | Overriding Superclass Methods | 299 |
6.4 | Polymorphism | 303 |
6.5 | Instanceof Operator | 307 |
6.6 | Shadowed Variables | 309 |
6.7 | Inner Classes | 312 |
6.8 | Abstract Methods and Classes | 312 |
Case Study: Boats | 317 | |
6.9 | Interfaces | 339 |
6.10 | Constructors Revisited | 345 |
6.11 | Instance Methods Revisited | 347 |
6.12 | Object Properties | 348 |
Comparing Objects | 348 | |
Copying Objects | 350 | |
Passing Objects as Parameters | 352 | |
Case Study: Arithmetic of Rational Numbers | 353 | |
6.13 | Garbage Collection and Object Finalization | 361 |
Summary | 363 | |
Review Questions | 365 | |
Exercises | 366 | |
Programming Problems | 371 | |
Chapter 7 | Exceptions and Streams | 375 |
7.1 | Introduction | 376 |
7.2 | Exception Classes | 377 |
7.3 | Catching an Exception | 379 |
7.4 | Catching Multiple Exceptions | 383 |
7.5 | Creating Your Own Exception Class | 387 |
7.6 | Throwing an Exception | 390 |
7.7 | Finally Blocks | 394 |
7.8 | Using Exception Handling | 396 |
7.9 | Stream Input and Output | 398 |
7.10 | The Stream Tokenizer Class | 404 |
7.11 | Text File Processing | 407 |
Book Example Problem | 412 | |
Another Example: Using a File Viewer | 417 | |
7.12 | The FileDialog Class | 419 |
Case Study: Reporting on the Statistics of a Text File | 422 | |
Summary | 433 | |
Review Questions | 434 | |
Exercises | 435 | |
Programming Problems | 438 | |
Chapter 8 | An Introduction to the java.awt Package | 443 |
8.1 | Creating a Container | 444 |
8.2 | Handling an Event | 448 |
8.3 | Adding a Button to the Container | 451 |
8.4 | Adding Labels, Fonts, and Text Fields to a Container | 457 |
Labels | 457 | |
Fonts | 458 | |
Text Fields | 461 | |
8.5 | Adding Check Boxes, Radio Buttons, and Lists to a Container | 465 |
Check Boxes | 465 | |
Radio Buttons | 468 | |
List | 472 | |
8.6 | Creating a Reusable Container | 476 |
8.7 | Creating a Reusable WritingPad Component | 480 |
8.8 | Creating a Reusable DialogBox Component | 486 |
8.9 | Creating a Reusable CheckBoxes Component | 491 |
8.10 | Java Swing | 497 |
Summary | 497 | |
Review Questions | 499 | |
Exercises | 500 | |
Programming Problems | 500 | |
Chapter 9 | Vectors, Serialization, and the java.awt Graphics Class | 501 |
9.1 | Vectors | 502 |
Case Study: Chemical Elements | 508 | |
9.2 | Saving and Loading Serializable Objects | 520 |
9.3 | The Graphics Class | 524 |
9.4 | Mouse Events | 527 |
9.5 | Pop-Up Menus | 534 |
9.6 | Painting the Screen | 544 |
9.7 | Printing Objects | 548 |
Summary | 558 | |
Review Questions | 558 | |
Exercises | 559 | |
Programming Problems | 560 | |
Chapter 10 | Objects Working Together | 563 |
10.1 | Packages | 564 |
10.2 | Associations | 570 |
10.3 | CRC Cards | 582 |
10.4 | Aggregation | 586 |
10.5 | Composition | 598 |
10.6 | Building a Student Management System | 599 |
10.7 | Menus Revisited | 604 |
10.8 | Testing the Student Management System | 608 |
Summary | 613 | |
Review Questions | 614 | |
Exercises | 615 | |
Programming Problems | 616 | |
Chapter 11 | Applets and Threads | 619 |
11.1 | Introduction | 620 |
11.2 | Applets | 622 |
11.3 | Input to Applets | 628 |
11.4 | Playing Sounds | 634 |
11.5 | Displaying Images | 637 |
11.6 | Loading Images | 639 |
11.7 | Arrays Revisited | 641 |
11.8 | Image Maps | 645 |
11.9 | Threads | 649 |
Case Study: An Example of Multithreading | 657 | |
11.10 | Animation | 668 |
11.11 | Restrictions | 673 |
11.12 | Sound and Images with Applications | 674 |
Sound | 675 | |
Images | 675 | |
11.13 | Conclusion | 676 |
Summary | 677 | |
Review Questions | 679 | |
Exercises | 680 | |
Programming Problems | 682 | |
Chapter 12 | Sorting, Searching, and Dynamic Data Structures | 685 |
12.1 | Sorting | 686 |
12.2 | Class java.util.Arrays--Sort | |
12.3 | Sequential Search | 700 |
12.4 | Class java.util.Arrays--Binary Search | |
12.5 | Linked Lists | 708 |
LinkedList Class | 718 | |
12.6 | Stacks | 726 |
Case Study: Using a Stack for Converting Algebraic Expressions | 728 | |
Summary | 738 | |
Review Questions | 739 | |
Exercises | 739 | |
Programming Problems | 739 | |
Appendix A | Tables | 743 |
A.1 | ASCII Characters | 743 |
A.2 | Java Primitive Data Types | 744 |
A.3 | Operator Priorities | 745 |
A.4 | Escape-Sequence Characters | 746 |
Appendix B | Syntax of Java | 747 |
B.1 | Productions of Lexical Structures | 747 |
B.2 | Productions from Types, Values, and Variables | 747 |
B.3 | Productions from Names | 748 |
B.4 | Productions from Packages | 748 |
B.5 | Productions Used Only in the LALR(1) Grammar | 749 |
B.6 | Productions from Classes | 749 |
Productions from Class Declarations | 749 | |
Productions from Field Declarations | 750 | |
Productions from Method Declarations | 751 | |
Productions from Static Initializers | 751 | |
Productions from Constructor Declarations | 751 | |
B.7 | Productions from Interfaces | 752 |
Productions from Interface Declarations | 752 | |
B.8 | Productions from Arrays | 752 |
B.9 | Productions from Blocks and Statements | 753 |
B.10 | Productions from Expressions | 756 |
Appendix C | Answers to Exercises | 761 |
Index | 805 |
Customer Reviews
Average Review: