| |
| |
Preface | |
| |
| |
Before You Begin | |
| |
| |
| |
Introduction to Computers, the Internet and the World Wide Web | |
| |
| |
| |
Introduction | |
| |
| |
| |
What Is a Computer? | |
| |
| |
| |
Computer Organization | |
| |
| |
| |
Early Operating Systems | |
| |
| |
| |
Personal, Distributed and Client/Server Computing | |
| |
| |
| |
The Internet and the World Wide Web | |
| |
| |
| |
Machine Languages, Assembly Languages and High-Level Languages | |
| |
| |
| |
History of C and C++ | |
| |
| |
| |
History of Java | |
| |
| |
| |
Java Class Libraries | |
| |
| |
| |
Fortran, Cobol, Pascal and Ada | |
| |
| |
| |
Basic, Visual Basic, Visual C++, C# and .Net | |
| |
| |
| |
Typical Java Development Environment | |
| |
| |
| |
Notes about Java and Small Java How to Program, Sixth Edition | |
| |
| |
| |
Test-Driving a Java Application | |
| |
| |
| |
Introduction to Object Technology and the UML | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Web Resources | |
| |
| |
| |
Introduction to Java Applications | |
| |
| |
| |
Introduction | |
| |
| |
| |
First Program in Java: Printing a Line of Text | |
| |
| |
| |
Modifying Our First Java Program | |
| |
| |
| |
Displaying Text with printf | |
| |
| |
| |
Another Java Application: Adding Integers | |
| |
| |
| |
Memory Concepts | |
| |
| |
| |
Arithmetic | |
| |
| |
| |
Decision Making: Equality and Relational Operators | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Introduction to Classes and Objects | |
| |
| |
| |
Introduction | |
| |
| |
| |
Classes, Objects, Methods and Instance Variables | |
| |
| |
| |
Declaring a Class with a Method and Instantiating an Object of a Class | |
| |
| |
| |
Declaring a Method with a Parameter | |
| |
| |
| |
Instance Variables, set Methods and get Methods | |
| |
| |
| |
Primitive Types vs. Reference Types | |
| |
| |
| |
Initializing Objects with Constructors | |
| |
| |
| |
Floating-Point Numbers and Type double | |
| |
| |
| |
(Optional) GUI and Graphics Case Study: Using Dialog Boxes | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Control Statements | |
| |
| |
| |
Introduction | |
| |
| |
| |
Algorithms | |
| |
| |
| |
Pseudocode | |
| |
| |
| |
Control Structures | |
| |
| |
| |
if Single-Selection Statement | |
| |
| |
| |
if...else Double-Selection Statement | |
| |
| |
| |
while Repetition Statement | |
| |
| |
| |
Formulating Algorithms: Counter-Controlled Repetition | |
| |
| |
| |
Formulating Algorithms: Sentinel-Controlled Repetition | |
| |
| |
| |
Formulating Algorithms: Nested Control Statements | |
| |
| |
| |
Compound Assignment Operators | |
| |
| |
| |
Increment and Decrement Operators | |
| |
| |
| |
Primitive Types | |
| |
| |
| |
(Optional) GUI and Graphics Case Study: Creating Simple Drawings | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Control Statements: Part 2 | |
| |
| |
| |
Introduction | |
| |
| |
| |
Essentials of Counter-Controlled Repetition | |
| |
| |
| |
for Repetition Statement | |
| |
| |
| |
Examples Using the for Statement | |
| |
| |
| |
do...while Repetition Statement | |
| |
| |
| |
switch Multiple-Selection Statement | |
| |
| |
| |
break and continue Statements | |
| |
| |
| |
Logical Operators | |
| |
| |
| |
Structured Programming Summary | |
| |
| |
| |
(Optional) GUI and Graphics Case Study: Drawing Rectangles and Ovals | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Methods: A Deeper Look | |
| |
| |
| |
Introduction | |
| |
| |
| |
Program Modules in Java | |
| |
| |
| |
Static Methods, static Fields and Class Math | |
| |
| |
| |
Declaring Methods with Multiple Parameters | |
| |
| |
| |
Notes on Declaring and Using Methods | |
| |
| |
| |
Method Call Stack and Activation Records | |
| |
| |
| |
Argument Promotion and Casting | |
| |
| |
| |
Java API Packages | |
| |
| |
| |
Case Study: Random-Number Generation | |
| |
| |
| |
Generalized Scaling and Shifting of Random Numbers | |
| |
| |
| |
Random-Number Repeatability for Testing and Debugging | |
| |
| |
| |
Case Study: A Game of Chance (Introducing Enumerations) | |
| |
| |
| |
Scope of Declarations | |
| |
| |
| |
Method Overloading | |
| |
| |
| |
(Optional) GUI and Graphics Case Study: Colors and Filled Shapes | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Arrays | |
| |
| |
| |
Introduction | |
| |
| |
| |
Arrays | |
| |
| |
| |
Declaring and Creating Arrays | |
| |
| |
| |
Examples Using Arrays | |
| |
| |
| |
Case Study: Card Shuffling and Dealing Simulation | |
| |
| |
| |
Enhanced for Statement | |
| |
| |
| |
Passing Arrays to Methods | |
| |
| |
| |
Case Study: Class GradeBook Using an Array to Store Grades | |
| |
| |
| |
Multidimensional Arrays | |
| |
| |
| |
Case Study: Class GradeBook Using a Two-Dimensional Array | |
| |
| |
| |
Variable-Length Argument Lists | |
| |
| |
| |
Using Command-Line Arguments | |
| |
| |
| |
(Optional) GUI and Graphics Case Study: Drawing Arcs | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Classes and Objects: A Deeper Look | |
| |
| |
| |
Introduction | |
| |
| |
| |
Time Class Case Study | |
| |
| |
| |
Controlling Access to Members | |
| |
| |
| |
Referring to the Current Object's Members with the this Reference | |
| |
| |
| |
Time Class Case Study: Overloaded Constructors | |
| |
| |
| |
Default and No-Argument Constructors | |
| |
| |
| |
Notes on Set and Get Methods | |
| |
| |
| |
Composition | |
| |
| |
| |
Enumerations | |
| |
| |
| |
Garbage Collection and Method finalize | |
| |
| |
| |
static Class Members | |
| |
| |
| |
static Import | |
| |
| |
| |
final Instance Variables | |
| |
| |
| |
Software Reusability | |
| |
| |
| |
Data Abstraction and Encapsulation | |
| |
| |
| |
Time Class Case Study: Creating Packages | |
| |
| |
| |
Package Access | |
| |
| |
| |
(Optional) GUI and Graphics Case Study: Using Objects with Graphics | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Object-Oriented Programming: Inheritance | |
| |
| |
| |
Introduction | |
| |
| |
| |
Superclasses and Subclasses | |
| |
| |
| |
Protected Members | |
| |
| |
| |
Relationship between Superclasses and Subclasses | |
| |
| |
| |
Creating and Using a CommissionEmployee Class | |
| |
| |
| |
Creating a BasePlusCommissionEmployee Class without Using Inheritance | |
| |
| |
| |
Creating a CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy | |
| |
| |
| |
CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables | |
| |
| |
| |
CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables | |
| |
| |
| |
Constructors in Subclasses | |
| |
| |
| |
Software Engineering with Inheritance | |
| |
| |
| |
Object Class | |
| |
| |
| |
(Optional) GUI and Graphics Case Study: Displaying Text and Images Using Labels | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Object-Oriented Programming: Polymorphism | |
| |
| |
| |
Introduction | |
| |
| |
| |
Polymorphism Examples | |
| |
| |
| |
Demonstrating Polymorphic Behavior | |
| |
| |
| |
Abstract Classes and Methods | |
| |
| |
| |
Case Study: Payroll System Using Polymorphism | |
| |
| |
| |
Creating Abstract Superclass Employee | |
| |
| |
| |
Creating Concrete Subclass SalariedEmployee | |
| |
| |
| |
Creating Concrete Subclass HourlyEmployee | |
| |
| |
| |
Creating Concrete Subclass CommissionEmployee | |
| |
| |
| |
Creating Indirect Concrete Subclass BasePlusCommissionEmployee | |
| |
| |
| |
Demonstrating Polymorphic Processing, Operator instanceof and Downcasting | |
| |
| |
| |
Summary of the Allowed Assignments Between Superclass and Subclass Variables | |
| |
| |
| |
Final Methods and Classes | |
| |
| |
| |
Case Study: Creating and Using Interfaces | |
| |
| |
| |
Developing a Payable Hierarchy | |
| |
| |
| |
Declaring Interface Payable | |
| |
| |
| |
Creating Class Invoice | |
| |
| |
| |
Modifying Class Employee to Implement Interface Payable | |
| |
| |
| |
Modifying Class SalariedEmployee for Use in the Payable Hierarchy | |
| |
| |
| |
Using Interface Payable to Process Invoices and Employees Polymorphically | |
| |
| |
| |
Declaring Constants with Interfaces | |
| |
| |
| |
Common Interfaces of the Java API | |
| |
| |
| |
(Optional) GUI and Graphics Case Study: Drawing with Polymorphism | |
| |
| |
| |
Wrap-Up | |
| |
| |
| |
Operator Precedence Chart | |
| |
| |
| |
Operator Precedence | |
| |
| |
| |
ASCII Character Set | |
| |
| |
| |
Keywords and Reserved Words | |
| |
| |
| |
Primitive Types | |
| |
| |
| |
Number Systems | |
| |
| |
| |
Introduction | |
| |
| |
| |
Abbreviating Binary Numbers as Octal and Hexadecimal Numbers | |
| |
| |
| |
Converting Octal and Hexadecimal Numbers to Binary Numbers | |
| |
| |
| |
Converting from Binary, Octal or Hexadecimal to Decimal | |
| |
| |
| |
Converting from Decimal to Binary, Octal or Hexadecimal | |
| |
| |
| |
Negative Binary Numbers: Two's Complement Notation | |
| |
| |
| |
Unicode | |
| |
| |
| |
Introduction | |
| |
| |
| |
Unicode Transformation Formats | |
| |
| |
| |
Characters and Glyphs | |
| |
| |
| |
Advantages/Disadvantages of Unicode | |
| |
| |
| |
Unicode Consortium's Web Site | |
| |
| |
| |
Using Unicode | |
| |
| |
| |
Character Ranges | |
| |
| |
| |
Using the Java API Documentation | |
| |
| |
| |
Introduction | |
| |
| |
| |
Navigating the Java API | |
| |
| |
| |
Creating Documentation with javadoc | |
| |
| |
| |
Introduction | |
| |
| |
| |
Documentation Comments | |
| |
| |
| |
Documenting Java Source Code | |
| |
| |
| |
javadoc | |
| |
| |
| |
Files Produced by javadoc | |
| |
| |
| |
Labeled break and continue Statements | |
| |
| |
| |
Introduction | |
| |
| |
| |
Labeled break Statement | |
| |
| |
| |
Labeled continue Statement | |
| |
| |
| |
Using the Debugger | |
| |
| |
| |
Introduction | |
| |
| |
| |
Breakpoints and the run, stop, cont and print Commands | |
| |
| |
| |
The print and set Commands | |
| |
| |
| |
Controlling Execution Using the step, step up and next Commands | |
| |
| |
| |
The watch Command | |
| |
| |
| |
The clear Command | |
| |
| |
| |
Wrap-Up | |
| |
| |
Index | |