Preface | p. XI |
Read this Before you Begin | p. XIV |
An Introduction to Java and the Java Programming Environment | p. 1 |
The Java Programming Language | p. 2 |
Three Types of Java Programs | p. 2 |
An Introduction to Object-Oriented Terminology | p. 3 |
Downloading the Java Standard Edition Development Kit (JDK) | p. 4 |
The Structure of a Java Program | p. 4 |
The Java Development Cycle | p. 6 |
Writing Java Source Code | p. 7 |
Compiling a Java Program | p. 7 |
Executing a Java Program | p. 8 |
Exercise 1-1: Understanding Java Utilities | p. 10 |
Lab 1-1: Compiling and Executing A Java Program | p. 10 |
Variables, Operators, and Writing Programs Using Sequential Statements | p. 11 |
Variables | p. 12 |
Variable Names | p. 12 |
Java Data Types | p. 13 |
Exercise 2-1: Using Java Variables, Data Types, and Keywords | p. 13 |
Declaring and Initializing Variables | p. 14 |
Exercise 2-2: Declaring and Initializing Java Variables | p. 15 |
Lab 2-1: Declaring and Initializing Java Variables | p. 16 |
Arithmetic and Assignment Operators | p. 16 |
Arithmetic Operators | p. 16 |
Assignment Operators and the Assignment Statement | p. 18 |
Precedence and Associativity | p. 19 |
Exercise 2-3: Understanding Operator Precedence and Associativity | p. 20 |
Lab 2-2: Arithmetic and Assignment Operators | p. 21 |
Sequential Statements and Interactive Input Statements | p. 22 |
Exercise 2-4: Understanding Sequential Statements | p. 24 |
Lab 2-3: Using Sequential Statements in a Java Program | p. 26 |
Writing Structured Java Programs | p. 29 |
Using Flowcharts and Pseudocode to Write a Java Program | p. 30 |
Lab 3-1: Using Flowcharts and Pseudocode to Write a Java Program | p. 33 |
Java Comments | p. 35 |
Lab 3-2: Commenting Java Programs | p. 37 |
Writing a Modular Program in Java | p. 37 |
Lab 3-3: Writing a Modular Program in Java | p. 42 |
Writing Programs that Make Decisions | p. 43 |
Boolean Operators | p. 44 |
Relational Operators | p. 44 |
Logical Operators | p. 45 |
Relational and Logical Operator Precedence and Associativity | p. 46 |
Comparing Strings | p. 47 |
Decision Statements | p. 49 |
The If Statement | p. 49 |
Exercise 4-1: Understanding if Statements | p. 51 |
Lab 4-1: Using if Statements | p. 52 |
The if-else Statement | p. 52 |
Exercise 4-2: Understanding if-else Statements | p. 54 |
Lab 4-2: Using if-else Statements | p. 55 |
Nested if Statements | p. 55 |
Exercise 4-3: Understanding Nested if Statements | p. 57 |
Lab 4-3: Using Nested if Statements | p. 58 |
The switch Statement | p. 59 |
Exercise 4-4: Using a switch Statement | p. 60 |
Lab 4-4: Using a switch Statement | p. 60 |
Using Decision Statements to Make Multiple Comparisons | p. 61 |
Using And Logic | p. 62 |
Using Or Logic | p. 62 |
Exercise 4-5: Making Multiple Comparisons in Decision Statements | p. 63 |
Lab 4-5: Making Multiple Comparisons in Decision Statements | p. 64 |
Writing Programs Using Loops | p. 67 |
The Increment (++) and Decrement (--) Operators | p. 68 |
Exercise 5-1: Using the Increment and Decrement Operators | p. 69 |
Writing a While Loop in Java | p. 70 |
Exercise 5-2: Using a while Loop | p. 71 |
Using a Counter to Control a Loop | p. 72 |
Exercise 5-3: Using a Counter-Controlled while Loop | p. 73 |
Lab 5-1: Using a Counter-Controlled while Loop | p. 73 |
Using a Sentinel Value to Control a Loop | p. 74 |
Exercise 5-4: Using a Sentinel Value to Control a while Loop | p. 75 |
Lab 5-2: Using a Sentinel Value to Control a while Loop | p. 76 |
Writing a for Loop in Java | p. 76 |
Exercise 5-5: Using a for Loop | p. 78 |
Lab 5-3: Using a for Loop | p. 78 |
Writing a Do-While Loop in Java | p. 79 |
Exercise 5-6: Using a do-while Loop | p. 79 |
Lab 5-4: Using a do-while Loop | p. 80 |
Nesting Loops | p. 80 |
Exercise 5-7: Nesting Loops | p. 81 |
Lab 5-5: Nesting Loops | p. 82 |
Accumulating Totals in a Loop | p. 83 |
Exercise 5-8: Accumulating Totals in a Loop | p. 84 |
Lab 5-6: Accumulating Totals in a Loop | p. 85 |
Using a Loop to Validate Input | p. 86 |
Exercise 5-9: Validating User Input | p. 87 |
Lab 5-7: Validating User Input | p. 88 |
Using Arrays in Java Programs | p. 89 |
Array Basics | p. 90 |
Declaring Arrays | p. 90 |
Initializing Arrays | p. 92 |
Accessing Array Elements | p. 92 |
Staying within the Bounds of an Array | p. 93 |
Using Constants with Arrays | p. 94 |
Exercise 6-1: Array Basics | p. 95 |
Lab 6-1: Using Arrays | p. 95 |
Searching an Array for an Exact Match | p. 96 |
Exercise 6-2: Searching an Array for an Exact Match | p. 98 |
Lab 6-2: Searching an Array for an Exact Match | p. 98 |
Parallel Arrays | p. 99 |
Exercise 6-3: Parallel Arrays | p. 102 |
Lab 6-3: Parallel Arrays | p. 102 |
Using Methods in Java Programs | p. 105 |
A Simple Java Method | p. 106 |
Exercise 7-1: Writing Simple Methods | p. 108 |
Lab 7-1: Writing Simple Methods | p. 108 |
Writing Methods that Require a Single Parameter | p. 109 |
Exercise 7-2: Writing Methods that Require a Single Parameter | p. 110 |
Lab 7-2: Writing Methods that Require a Single Parameter | p. 111 |
Writing Methods that Require Multiple Parameters | p. 112 |
Exercise 7-3: Writing Methods that Require Multiple Parameters | p. 113 |
Lab 7-3: Writing Methods that Require Multiple Parameters | p. 114 |
Writing Methods that Return a Value | p. 114 |
Exercise 7-4: Writing Methods that Return a Value | p. 116 |
Lab 7-4: Writing Methods that Return a Value | p. 117 |
Passing an Array and an Array Element to a Method | p. 117 |
Exercise 7-5: Passing Arrays to Methods | p. 120 |
Lab 7-5: Passing Arrays to Methods | p. 121 |
Overloading Methods | p. 122 |
Exercise 7-6: Overloading Methods | p. 124 |
Lab 7-6: Overloading Methods | p. 124 |
Using Java's Built-In Methods | p. 125 |
Exercise 7-7: Using Java's Built-in Methods | p. 125 |
Lab 7-7: Using Java's Built-in Methods | p. 126 |
Writing Control Break Programs | p. 129 |
Accumulating Totals in Single-Level Control Break Programs | p. 130 |
Exercise 8-1: Accumulating Totals in Single-Level Control Break Programs | p. 135 |
Lab 8-1: Accumulating Totals in Single-Level Control Break Programs | p. 135 |
Multiple-Level Control Break Programs | p. 137 |
Exercise 8-2: Multiple-Level Control Break Programs | p. 142 |
Lab 8-2: Multiple-Level Control Break Programs | p. 143 |
Sorting Data and File Input/Output | p. 145 |
Sorting Data | p. 146 |
Swapping Data Values | p. 146 |
Exercise 9-1: Swapping Values | p. 147 |
Lab 9-1: Swapping Values | p. 147 |
Using a Bullet Sort | p. 148 |
The main ( ) Method | p. 152 |
The fillArray ( ) Method | p. 152 |
The sortArray ( ) Method | p. 153 |
The displayArray ( ) Method | p. 154 |
Exercise 9-2: Using a Bubble Sort | p. 154 |
Lab 9-2: Using a Bubble Sort | p. 155 |
File Input and Output | p. 156 |
Importing Packages and Classes | p. 156 |
Opening a File for Reading | p. 156 |
Reading Data from an Input File | p. 157 |
Reading Data Using a Loop and EOF | p. 158 |
Opening a File for Writing | p. 158 |
Writing Data to an Output File | p. 159 |
Exercise 9-3: Opening Files and Performing File Input | p. 161 |
Lab 9-2: Using an Input File | p. 162 |
Additional Topics | p. 163 |
A Programmer-Defined Class | p. 164 |
Creating a Programmer-Defined Class | p. 164 |
Adding Attributes to a Class | p. 165 |
Adding Methods to a Class | p. 166 |
Exercise 10-1: Creating a Class in Java | p. 170 |
Lab 10-1: Creating a Class in Java | p. 171 |
Creating a Graphical User Interface (GUI) | p. 172 |
Writing a Constructor | p. 174 |
Writing the main ( ) Method | p. 176 |
Exercise 10-2: Creating a Graphical User Interface in Java | p. 177 |
Lab 10-2: Creating a Graphical User Interface in Java | p. 177 |
Index | p. 179 |
Table of Contents provided by Ingram. All Rights Reserved. |
The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.