Java How To Program 8th Edition (Late Objects) - Chapter Outlines Select a chapter: 1 2 3 4 5 6 7 8 9 10 11 14 16 17 1 Introduction to Computers, the Internet and the Web I 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 Introduction Computers: Hardware and Software 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 Java How to Program Test-Driving a Java Application Introduction to Object Technology and the UML Web 2.0 Software Technologies Wrap-Up Web Resources 2 3 4 5 6 6 7 8 8 9 10 11 11 14 15 20 24 25 26 26 Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 2 Introduction to Java Applications 37 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 Introduction Our First Program in Java: Printing a Line of Text Modifying Our First Java Program Displaying Text with printf Another Application: Adding Integers Memory Concepts Arithmetic / arithmetic operators Decision Making: Equality and Relational Operators (Optional) GUI and Graphics Case Study: Using Dialog Boxes Wrap-Up 38 38 44 46 47 52 53 56 60 63 Miscellaneous additional topics package class / enum / interface import statement Scanner class Scanner class constructor new keyword object / object reference variable Data Types: Value / Reference Java Quick Reference Guide / Java printf method Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 3 Control Statements: Part I 75 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 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 76 76 77 77 79 80 85 86 89 97 101 102 105 105 109 Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 4 Control Statements: Part 2 124 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 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 125 125 127 130 135 137 142 144 150 155 157 Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 5 Methods 167 5.1 5.2 5.3 5.4 Introduction Program Modules in Java static Methods, static Fields and Class Math Declaring Methods 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 168 168 170 172 176 177 178 179 181 185 185 186 190 192 195 198 5.6 5.7 5.8 5.9 5.9.1 5.9.2 5.10 5.11 5.12 5.13 5.14 Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 6 Arrays; Introducing Strings and Files 212 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 6.13 6.14 6.15 6.15.1 6.15.2 6.15.3 6.15.4 6.15.5 6.15-6 6.15.7 6.15.8 6.16 6.17 6.18 6.19 6.19.1 6.19.2 6.20 6.21 Introduction Primitive Types vs. Reference Types Arrays Declaring array reference variables, and Creating Arrays Examples Using Arrays Enhanced for Statement Passing Arrays to Methods Multidimensional Arrays Case Study: Summarizing Student Exam Grades Using a Two-Dimensional Array Variable-Length Argument Lists Using Command-Line Arguments Class Arrays (binary search, sort, copy) Introduction to Collections and Class ArrayList Fundamentals of Characters and Strings Class String Initializing Strings String Methods length, charAt and getChars Comparing Strings Locating Characters and Substrings in Strings Extracting Substrings from Strings Concatenating Strings Miscellaneous String Methods String Method valueOf Introduction to File Processing Data Hierarchy Files and Streams Sequential-Access Text Files Creating a Sequential-Access Text File Reading Data from a Sequential-Access Text File (Optional) GUI and Graphics Case Study: Drawing Arcs Wrap-Up 213 214 214 216 217 226 227 230 233 238 240 241 244 247 248 248 249 250 255 256 257 258 259 261 261 263 264 265 268 270 273 Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 7 Introduction to Classes and Objects 298 7.1 7.2 7.3 Introduction Classes, Objects, Methods, and Instance Variables (aka fields) Declaring a Class and Instantiating an Object of that Class variable local parameter list method body for loop 299 299 300 7.4 7.5 7.6 7.7 global instance variable (field) class variable (aka static variable) Initializing Objects with Constructors [ new, initializer list ] Case Study: Account Balances; Validating Constructor Arguments Case Study: Card Shuffling and Dealing Simulation Wrap-Up Top of the Document 308 311 315 319 Java How To Program 8th Edition (Late Objects) - Chapter Outlines 8 Classes and Objects: A Deeper Look 324 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 8.10 8.11 8.12 8.13 8.14 8.15 8.16 8.17 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 [System.gc( )], null value, and Method finalize static Class Members static Import final Instance Variables Time Class Case Study: Creating Packages Package Access (Optional) GUI and Graphics Case Study: Using Objects with Graphics 360 Wrap-Up 325 325 329 330 333 338 339 340 343 346 346 350 351 354 359 Top of the Document 364 Java How To Program 8th Edition (Late Objects) - Chapter Outlines 9 Object-Oriented Programming: Inheritance 373 9.1 9.2 9.3 9.4 9.4.1 9.4.2 Introduction Superclasses and Subclasses, extends keyword protected Members Relationship between Superclasses and Subclasses “is-a” Creating and Using a CommissionEmployeeClass Creating and Using a BasePlusCommissionEmployee Class Overriding an inherited method Creating a CommissionEmployee / BasePlusCommissionEmployee Inheritance Hierarchy Using a superclass method this.<method>( ) CommissionEmployee / BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables CommissionEmployee / BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables Constructors in Subclasses super( ), this( ) Software Engineering with Inheritance Object Class toString( ) [ object state ] finalize( ) [ ~ destructor ] (Optional) GUI and Graphics Case Study: Displaying Text and Images Using Labels Wrap-Up 374 375 377 378 378 383 9.4.3 9.4.4 9.4.5 9.5 9.6 9.7 9.8 9.9 Top of the Document 388 391 394 398 399 400 402 404 Java How To Program 8th Edition (Late Objects) - Chapter Outlines 10 Object-Oriented Programming: Polymorphism 408 10.1 10.2 10.3 10.4 10.5 10.5.1 10.5.2 10.5.3 10.5.4 10.5.5 10.5.6 10.5.7 10.6 10.7 10.7.1 10.7.2 10.7.3 10.7.4 10.7.5 10.7.6 10.7.7 10.8 10.9 Introduction superclass reference to a subclass object Polymorphism Examples Demonstrating Polymorphic Behavior Abstract Classes and Methods Case Study: Payroll System Using Polymorphism Abstract Superclass Employee Concrete Subclass SalariedEmployee Concrete Subclass HourlyEmployee Concrete Subclass CommissionEmployee Indirect Concrete Subclass BasePlusCommissionEmployee 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 Interface Payable Class Invoice Modifying Class Employee to Implement Interface Payable implements keyword Modifying Class SalariedEmployee for Use in the Payable Hierarchy Using Interface Payable to Process Invoices and Employees Polymorphically Common Interfaces of the Java API (Optional) GUI and Graphics Case Study: Drawing with Polymorphism 444 Wrap-Up 409 411 412 414 416 417 420 422 423 425 426 431 431 432 434 435 435 438 439 441 443 Top of the Document 446 Java How To Program 8th Edition (Late Objects) - Chapter Outlines 11 Exception Handling 451 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.10 11.11 11.12 11.13 11.14 Introduction Error-Handling Overview (try, catch, finally blocks) Example: Divide by Zero without Exception Handling Example: Handling ArithmeticExceptions and InputMismatchExceptions When to Use Exception Handling Java Exception Hierarchy finally Block Stack Unwinding printStackTrace, getStackTrace and getMessage Chained Exceptions Declaring New Exception Types Preconditions and Postconditions Assertions Wrap-Up 452 453 453 456 461 461 464 469 470 473 475 476 476 478 Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 14 GUI Components: Part I 563 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 14.10 14.10.1 14.10.2 14.11 14.12 14.13 14.14 14.15 14.16 14.17 14.18 14.18.1 14.18.2 14.18.3 14.19 14.20 14.21 Introduction Java's New Nimbus Look-and-Feel Simple GUI-Based Input/Output with JOptionPane Overview of Swing Components Displaying Text and Images in a Window Text Fields and an Introduction to Event Handling with Nested Classes Common GUI Event Types and Listener Interfaces How Event Handling Works JButton Buttons That Maintain State JCheckBox JRadioButton JComboBox and Using an Anonymous Inner Class for Event Handling JList Multiple-Selection Lists Mouse Event Handling Adapter Classes JPanel Subclass for Drawing with the Mouse Key Event Handling Introduction to Layout Managers FlowLayout BorderLayout GridLayout Using Panels to Manage More Complex Layouts JTextArea Wrap-Up 564 565 566 569 571 576 582 584 586 589 589 592 595 599 601 604 608 612 615 618 620 623 626 628 630 632 Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 16 Strings, Characters and Regular Expressions 689 16.1 16.2 16.2.1 16.2.2 16.2.3 16.2.4 16.2.5 16.3 16.4 16.5 16.6 Introduction Class St ringBuilder StringBuilder Constructors StringBuilder Methods length, capacity, setLength and ensureCapacity StringBuilder Methods charAt, setCharAt, getChars and reverse StringBuilder append Methods StringBuilder Insertion and Deletion Methods Class Character Tokenizing Strings Regular Expressions, Class Pattern and Class Matcher Wrap-Up 690 690 691 691 693 694 696 697 701 703 711 Top of the Document Java How To Program 8th Edition (Late Objects) - Chapter Outlines 17 Files, Streams and Object Serialization 719 17.1 17.2 17.3 17.4 17.4.1 17.4.2 17.4.3 17.5 17.5-1 17.5.2 17.6 17.6.1 17.6.2 17.7 17.8 Introduction The java. io Package Class File Case Study: A Credit-Inquiry Program Class AccountRecord Credit-Inquiry Program Updating Sequential-Access Files Object Serialization Creating a Sequential-Access File Using Object Serialization Reading and Deserializing Data from a Sequential-Access File Additional java. io Classes Interfaces and Classes for Byte-Based Input and Output Interfaces and Classes for Character-Based Input and Output Opening Files with DFileChooser Wrap-Up 720 720 721 725 725 727 733 733 734 740 743 743 744 745 748 Top of the Document