Small Java How to Program and CD Version One Package / Edition 1
by Harvey M. Deitel, Paul J. DeitelISBN-10: 0131541579
ISBN-13: 9780131541573
Pub. Date: 08/09/2004
Publisher: Pearson
Product Details
- ISBN-13:
- 9780131541573
- Publisher:
- Pearson
- Publication date:
- 08/09/2004
- Pages:
- 624
- Product dimensions:
- 6.98(w) x 9.12(h) x 0.72(d)
Table of Contents
| Preface | xv | |
| Before You Begin | xxxvii | |
| 1 | Introduction to Computers, the Internet and the World Wide Web | 1 |
| 1.1 | Introduction | 2 |
| 1.2 | What Is a Computer? | 4 |
| 1.3 | Computer Organization | 4 |
| 1.4 | Early Operating Systems | 5 |
| 1.5 | Personal, Distributed and Client/Server Computing | 6 |
| 1.6 | The Internet and the World Wide Web | 6 |
| 1.7 | Machine Languages, Assembly Languages and High-Level Languages | 7 |
| 1.8 | History of C and C++ | 8 |
| 1.9 | History of Java | 9 |
| 1.10 | Java Class Libraries | 9 |
| 1.11 | Fortran, Cobol, Pascal and Ada | 11 |
| 1.12 | Basic, Visual Basic, Visual C++, C# and .Net | 11 |
| 1.13 | Typical Java Development Environment | 12 |
| 1.14 | Notes about Java and Small Java How to Program, Sixth Edition | 15 |
| 1.15 | Test-Driving a Java Application | 16 |
| 1.16 | Introduction to Object Technology and the UML | 21 |
| 1.17 | Wrap-Up | 26 |
| 1.18 | Web Resources | 26 |
| 2 | Introduction to Java Applications | 35 |
| 2.1 | Introduction | 36 |
| 2.2 | First Program in Java: Printing a Line of Text | 36 |
| 2.3 | Modifying Our First Java Program | 43 |
| 2.4 | Displaying Text with printf | 45 |
| 2.5 | Another Java Application: Adding Integers | 47 |
| 2.6 | Memory Concepts | 51 |
| 2.7 | Arithmetic | 52 |
| 2.8 | Decision Making: Equality and Relational Operators | 56 |
| 2.9 | Wrap-Up | 60 |
| 3 | Introduction to Classes and Objects | 72 |
| 3.1 | Introduction | 73 |
| 3.2 | Classes, Objects, Methods and Instance Variables | 73 |
| 3.3 | Declaring a Class with a Method and Instantiating an Object of a Class | 75 |
| 3.4 | Declaring a Method with a Parameter | 79 |
| 3.5 | Instance Variables, set Methods and get Methods | 82 |
| 3.6 | Primitive Types vs. Reference Types | 87 |
| 3.7 | Initializing Objects with Constructors | 88 |
| 3.8 | Floating-Point Numbers and Type double | 91 |
| 3.9 | (Optional) GUI and Graphics Case Study: Using Dialog Boxes | 95 |
| 3.10 | Wrap-Up | 98 |
| 4 | Control Statements | 106 |
| 4.1 | Introduction | 107 |
| 4.2 | Algorithms | 107 |
| 4.3 | Pseudocode | 108 |
| 4.4 | Control Structures | 108 |
| 4.5 | if Single-Selection Statement | 111 |
| 4.6 | if...else Double-Selection Statement | 112 |
| 4.7 | while Repetition Statement | 117 |
| 4.8 | Formulating Algorithms: Counter-Controlled Repetition | 118 |
| 4.9 | Formulating Algorithms: Sentinel-Controlled Repetition | 123 |
| 4.10 | Formulating Algorithms: Nested Control Statements | 130 |
| 4.11 | Compound Assignment Operators | 136 |
| 4.12 | Increment and Decrement Operators | 137 |
| 4.13 | Primitive Types | 139 |
| 4.14 | (Optional) GUI and Graphics Case Study: Creating Simple Drawings | 140 |
| 4.15 | Wrap-Up | 145 |
| 5 | Control Statements: Part 2 | 157 |
| 5.1 | Introduction | 158 |
| 5.2 | Essentials of Counter-Controlled Repetition | 158 |
| 5.3 | for Repetition Statement | 160 |
| 5.4 | Examples Using the for Statement | 164 |
| 5.5 | do...while Repetition Statement | 169 |
| 5.6 | switch Multiple-Selection Statement | 170 |
| 5.7 | break and continue Statements | 178 |
| 5.8 | Logical Operators | 180 |
| 5.9 | Structured Programming Summary | 186 |
| 5.10 | (Optional) GUI and Graphics Case Study: Drawing Rectangles and Ovals | 191 |
| 5.11 | Wrap-Up | 194 |
| 6 | Methods: A Deeper Look | 204 |
| 6.1 | Introduction | 205 |
| 6.2 | Program Modules in Java | 206 |
| 6.3 | Static Methods, static Fields and Class Math | 207 |
| 6.4 | Declaring Methods with Multiple Parameters | 210 |
| 6.5 | Notes on Declaring and Using Methods | 214 |
| 6.6 | Method Call Stack and Activation Records | 215 |
| 6.7 | Argument Promotion and Casting | 215 |
| 6.8 | Java API Packages | 217 |
| 6.9 | Case Study: Random-Number Generation | 219 |
| 6.9.1 | Generalized Scaling and Shifting of Random Numbers | 223 |
| 6.9.2 | Random-Number Repeatability for Testing and Debugging | 223 |
| 6.10 | Case Study: A Game of Chance (Introducing Enumerations) | 224 |
| 6.11 | Scope of Declarations | 229 |
| 6.12 | Method Overloading | 232 |
| 6.13 | (Optional) GUI and Graphics Case Study: Colors and Filled Shapes | 235 |
| 6.14 | Wrap-Up | 237 |
| 7 | Arrays | 252 |
| 7.1 | Introduction | 253 |
| 7.2 | Arrays | 253 |
| 7.3 | Declaring and Creating Arrays | 255 |
| 7.4 | Examples Using Arrays | 256 |
| 7.5 | Case Study: Card Shuffling and Dealing Simulation | 265 |
| 7.6 | Enhanced for Statement | 268 |
| 7.7 | Passing Arrays to Methods | 270 |
| 7.8 | Case Study: Class GradeBook Using an Array to Store Grades | 274 |
| 7.9 | Multidimensional Arrays | 278 |
| 7.10 | Case Study: Class GradeBook Using a Two-Dimensional Array | 283 |
| 7.11 | Variable-Length Argument Lists | 289 |
| 7.12 | Using Command-Line Arguments | 290 |
| 7.13 | (Optional) GUI and Graphics Case Study: Drawing Arcs | 292 |
| 7.14 | Wrap-Up | 295 |
| 8 | Classes and Objects: A Deeper Look | 316 |
| 8.1 | Introduction | 317 |
| 8.2 | Time Class Case Study | 318 |
| 8.3 | Controlling Access to Members | 321 |
| 8.4 | Referring to the Current Object's Members with the this Reference | 322 |
| 8.5 | Time Class Case Study: Overloaded Constructors | 325 |
| 8.6 | Default and No-Argument Constructors | 330 |
| 8.7 | Notes on Set and Get Methods | 331 |
| 8.8 | Composition | 332 |
| 8.9 | Enumerations | 334 |
| 8.10 | Garbage Collection and Method finalize | 338 |
| 8.11 | static Class Members | 339 |
| 8.12 | static Import | 344 |
| 8.13 | final Instance Variables | 345 |
| 8.14 | Software Reusability | 347 |
| 8.15 | Data Abstraction and Encapsulation | 348 |
| 8.16 | Time Class Case Study: Creating Packages | 349 |
| 8.17 | Package Access | 355 |
| 8.18 | (Optional) GUI and Graphics Case Study: Using Objects with Graphics | 355 |
| 8.19 | Wrap-Up | 360 |
| 9 | Object-Oriented Programming: Inheritance | 369 |
| 9.1 | Introduction | 370 |
| 9.2 | Superclasses and Subclasses | 371 |
| 9.3 | Protected Members | 373 |
| 9.4 | Relationship between Superclasses and Subclasses | 374 |
| 9.4.1 | Creating and Using a CommissionEmployee Class | 375 |
| 9.4.2 | Creating a BasePlusCommissionEmployee Class without Using Inheritance | 379 |
| 9.4.3 | Creating a CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy | 384 |
| 9.4.4 | CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables | 387 |
| 9.4.5 | CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables | 393 |
| 9.5 | Constructors in Subclasses | 398 |
| 9.6 | Software Engineering with Inheritance | 404 |
| 9.7 | Object Class | 405 |
| 9.8 | (Optional) GUI and Graphics Case Study: Displaying Text and Images Using Labels | 407 |
| 9.9 | Wrap-Up | 409 |
| 10 | Object-Oriented Programming: Polymorphism | 413 |
| 10.1 | Introduction | 414 |
| 10.2 | Polymorphism Examples | 416 |
| 10.3 | Demonstrating Polymorphic Behavior | 417 |
| 10.4 | Abstract Classes and Methods | 420 |
| 10.5 | Case Study: Payroll System Using Polymorphism | 422 |
| 10.5.1 | Creating Abstract Superclass Employee | 423 |
| 10.5.2 | Creating Concrete Subclass SalariedEmployee | 426 |
| 10.5.3 | Creating Concrete Subclass HourlyEmployee | 427 |
| 10.5.4 | Creating Concrete Subclass CommissionEmployee | 429 |
| 10.5.5 | Creating Indirect Concrete Subclass BasePlusCommissionEmployee | 430 |
| 10.5.6 | Demonstrating Polymorphic Processing, Operator instanceof and Downcasting | 432 |
| 10.5.7 | Summary of the Allowed Assignments Between Superclass and Subclass Variables | 436 |
| 10.6 | Final Methods and Classes | 437 |
| 10.7 | Case Study: Creating and Using Interfaces | 438 |
| 10.7.1 | Developing a Payable Hierarchy | 439 |
| 10.7.2 | Declaring Interface Payable | 440 |
| 10.7.3 | Creating Class Invoice | 441 |
| 10.7.4 | Modifying Class Employee to Implement Interface Payable | 443 |
| 10.7.5 | Modifying Class SalariedEmployee for Use in the Payable Hierarchy | 445 |
| 10.7.6 | Using Interface Payable to Process Invoices and Employees Polymorphically | 447 |
| 10.7.7 | Declaring Constants with Interfaces | 448 |
| 10.7.8 | Common Interfaces of the Java API | 449 |
| 10.8 | (Optional) GUI and Graphics Case Study: Drawing with Polymorphism | 450 |
| 10.9 | Wrap-Up | 452 |
| A | Operator Precedence Chart | 456 |
| A.1 | Operator Precedence | 456 |
| B | ASCII Character Set | 458 |
| C | Keywords and Reserved Words | 459 |
| D | Primitive Types | 460 |
| E | Number Systems | 461 |
| E.1 | Introduction | 462 |
| E.2 | Abbreviating Binary Numbers as Octal and Hexadecimal Numbers | 465 |
| E.3 | Converting Octal and Hexadecimal Numbers to Binary Numbers | 466 |
| E.4 | Converting from Binary, Octal or Hexadecimal to Decimal | 466 |
| E.5 | Converting from Decimal to Binary, Octal or Hexadecimal | 467 |
| E.6 | Negative Binary Numbers: Two's Complement Notation | 469 |
| F | Unicode | 474 |
| F.1 | Introduction | 474 |
| F.2 | Unicode Transformation Formats | 475 |
| F.3 | Characters and Glyphs | 476 |
| F.4 | Advantages/Disadvantages of Unicode | 477 |
| F.5 | Unicode Consortium's Web Site | 477 |
| F.6 | Using Unicode | 479 |
| F.7 | Character Ranges | 481 |
| G | Using the Java API Documentation | 485 |
| G.1 | Introduction | 485 |
| G.2 | Navigating the Java API | 486 |
| H | Creating Documentation with javadoc | 495 |
| H.1 | Introduction | 495 |
| H.2 | Documentation Comments | 495 |
| H.3 | Documenting Java Source Code | 496 |
| H.4 | javadoc | 503 |
| H.5 | Files Produced by javadoc | 504 |
| I | Labeled break and continue Statements | 507 |
| I.1 | Introduction | 507 |
| I.2 | Labeled break Statement | 507 |
| I.3 | Labeled continue Statement | 508 |
| J | Using the Debugger | 510 |
| J.1 | Introduction | 511 |
| J.2 | Breakpoints and the run, stop, cont and print Commands | 511 |
| J.3 | The print and set Commands | 516 |
| J.4 | Controlling Execution Using the step, step up and next Commands | 518 |
| J.5 | The watch Command | 521 |
| J.6 | The clear Command | 523 |
| J.7 | Wrap-Up | 526 |
| Index | 527 |
Customer Reviews
Average Review: