Autore |
Savitch Walter J. <1943-2021, >
|
Edizione | [Sixth edition, Global edition.] |
Pubbl/distr/stampa |
Boston : , : Pearson, , [2016]
|
Descrizione fisica |
1 online resource (1,295 pages) : illustrations (some color), tables
|
Disciplina |
005.133
|
Collana |
Always learning
|
Soggetto topico |
Java (Computer program language)
|
ISBN |
1-292-10923-8
|
Formato |
Materiale a stampa |
Livello bibliografico |
Monografia |
Lingua di pubblicazione |
eng
|
Nota di contenuto |
Cover -- Title Page -- Copyright Page -- Preface -- Acknowledgments -- Brief Contents -- Contents -- Chapter 1 Getting Started -- 1.1 INTRODUCTION TO JAVA -- Origins of the Java Language -- Objects and Methods -- Applets -- A Sample Java Application Program -- Byte-Code and the Java Virtual Machine -- Class Loader -- Compiling a Java Program or Class -- Running a Java Program -- TIP: Error Messages -- 1.2 EXPRESSIONS AND ASSIGNMENT STATEMENTS -- Identifiers -- Variables -- Assignment Statements -- TIP: Initialize Variables -- More Assignment Statements -- Assignment Compatibility -- Constants -- Arithmetic Operators and Expressions -- Parentheses and Precedence Rules -- Integer and Floating-Point Division -- PITFALL: Round-Off Errors in Floating-Point Numbers -- PITFALL: Division with Whole Numbers -- Type Casting -- Increment and Decrement Operators -- 1.3 THE CLASS STRING -- String Constants and Variables -- Concatenation of Strings -- Classes -- String Methods -- Escape Sequences -- String Processing -- The Unicode Character Set -- 1.4 PROGRAM STYLE -- Naming Constants -- Java Spelling Conventions -- Comments -- Indenting -- Chapter Summary -- Answers to Self-Test Exercises -- Programming Projects -- Chapter 2 Console Input and Output -- 2.1 SCREEN OUTPUT -- System.out.println -- TIP: Different Approaches to Formatting Output -- Formatting Output with printf -- TIP: Formatting Monetary Amounts with printf -- TIP: Legacy Code -- Money Formats Using NumberFormat -- Importing Packages and Classes -- The DecimalFormat Class -- 2.2 CONSOLE INPUT USING THE SCANNER CLASS -- The Scanner Class -- PITFALL: Dealing with the Line Terminator, '\n' -- The Empty String -- TIP: Prompt for Input -- TIP: Echo Input -- Example: Self-Service Checkout -- Other Input Delimiters -- 2.3 INTRODUCTION TO FILE INPUT -- The Scanner Class for Text File Input.
Chapter Summary -- Answers to Self-Test Exercises -- Programming Projects -- Chapter 3 Flow of Control -- 3.1 BRANCHING MECHANISM -- if-else Statements -- Omitting the else -- Compound Statements -- TIP: Placing of Braces -- Nested Statements -- Multiway if-else Statement -- Example: State Income Tax -- The switch Statement -- PITFALL: Forgetting a break in a switch Statement -- The Conditional Operator -- 3.2 BOOLEAN EXPRESSIONS -- Simple Boolean Expressions -- PITFALL: Using = in Place of == -- PITFALL: Using == with Strings -- Lexicographic and Alphabetic Order -- Building Boolean Expressions -- PITFALL: Strings of Inequalities -- Evaluating Boolean Expressions -- TIP: Naming Boolean Variables -- Short-Circuit and Complete Evaluation -- Precedence and Associativity Rules -- 3.3 LOOPS -- while Statement and do-while Statement -- Algorithms and Pseudocode -- Example: Averaging a List of Scores -- The for Statement -- The Comma in for Statements -- TIP: Repeat N Times Loops -- PITFALL: Extra Semicolon in a for Statement -- PITFALL: Infinite Loops -- Nested Loops -- The break and continue Statements -- The exit Statement -- 3.4 DEBUGGING -- Loop Bugs -- Tracing Variables -- General Debugging Techniques -- Example: Debugging an Input Validation Loop -- Preventive Coding -- Assertion Checks -- 3.5 RANDOM NUMBER GENERATION -- The Random Object -- The Math.random() Method -- Chapter Summary -- Answers to Self-Test Exercises -- Programming Projects -- Chapter 4 Defining Classes I -- 4.1 CLASS DEFINITIONS -- Instance Variables and Methods -- More about Methods -- TIP: Any Method Can Be Used as a void Method -- Local Variables -- Blocks -- TIP: Declaring Variables in a for Statement -- Parameters of a Primitive Type -- PITFALL: Use of the Terms "Parameter" and "Argument" -- Simple Cases with Class Parameters -- The this Parameter.
Methods That Return a Boolean Value -- The Methods equals and toString -- Recursive Methods -- TIP: Testing Methods -- 4.2 INFORMATION HIDING AND ENCAPSULATION -- public and private Modifiers -- Example: Yet Another Date Class -- Accessor and Mutator Methods -- TIP: A Class Has Access to Private Members of All Objects of the Class -- TIP: Mutator Methods Can Return a Boolean Value -- Preconditions and Postconditions -- 4.3 OVERLOADING -- Rules for Overloading -- PITFALL: Overloading and Automatic Type Conversion -- PITFALL: You Cannot Overload Based on the Type Returned -- 4.4 CONSTRUCTORS -- Constructor Definitions -- TIP: You Can Invoke Another Method in a Constructor -- TIP: A Constructor Has a this Parameter -- TIP: Include a No-Argument Constructor -- Example: The Final Date Class -- Default Variable Initializations -- An Alternative Way to Initialize Instance Variables -- Example: A Pet Record Class -- The StringTokenizer Class -- Chapter Summary -- Answers to Self-Test Exercises -- Programming Projects -- Chapter 5 Defining Classes II -- 5.1 STATIC METHODS AND STATIC VARIABLES -- Static Methods -- PITFALL: Invoking a Nonstatic Method Within a Static Method -- TIP: You Can Put a main in Any Class -- Static Variables -- The Math Class -- Wrapper Classes -- Automatic Boxing and Unboxing -- Static Methods in Wrapper Classes -- PITFALL: A Wrapper Class Does Not Have a No-Argument Constructor -- 5.2 REFERENCES AND CLASS PARAMETERS -- Variables and Memory -- References -- Class Parameters -- PITFALL: Use of = and == with Variables of a Class Type -- The Constant null -- PITFALL: Null Pointer Exception -- The new Operator and Anonymous Objects -- Example: Another Approach to Keyboard Input -- TIP: Use Static Imports -- 5.3 USING AND MISUSING REFERENCES -- Example: A Person Class -- PITFALL: null Can Be an Argument to a Method -- Copy Constructors.
PITFALL: Privacy Leaks -- Mutable and Immutable Classes -- Tip: Deep Copy versus Shallow Copy -- TIP: Assume Your Coworkers Are Malicious -- 5.4 PACKAGES AND JAVADOC -- Packages and import Statements -- The Package java.lang -- Package Names and Directories -- PITFALL: Subdirectories Are Not Automatically Imported -- The Default Package -- PITFALL: Not Including the Current Directory in Your Class Path -- Specifying a Class Path When You Compile -- Name Clashes -- Introduction to javadoc -- Commenting Classes for javadoc -- Running javadoc -- Chapter Summary -- Answers to Self-Test Exercises -- Programming Projects -- Chapter 6 Arrays -- 6.1 INTRODUCTION TO ARRAYS -- Creating and Accessing Arrays -- The length Instance Variable -- TIP: Use for Loops with Arrays -- PITFALL: Array Indices Always Start with Zero -- PITFALL: Array Index Out of Bounds -- Initializing Arrays -- PITFALL: An Array of Characters Is Not a String -- 6.2 ARRAYS AND REFERENCES -- Arrays Are Objects -- PITFALL: Arrays with a Class Base Type -- Array Parameters -- PITFALL: Use of = and == with Arrays -- Arguments for the Method main -- Methods that Return an Array -- 6.3 PROGRAMMING WITH ARRAYS -- Partially Filled Arrays -- Example: A Class for Partially Filled Arrays -- TIP: Accessor Methods Need Not Simply Return Instance Variables -- The "for-each" Loop -- Methods with a Variable Number of Parameters -- Example: A String Processing Example -- Privacy Leaks with Array Instance Variables -- Example: Sorting an Array -- Enumerated Types -- TIP: Enumerated Types in switch Statements -- 6.4 MULTIDIMENSIONAL ARRAYS -- Multidimensional Array Basics -- Using the length Instance Variable -- Ragged Arrays -- Multidimensional Array Parameters and Returned Values -- Example: A Grade Book Class -- Chapter Summary -- Answers to Self-Test Exercises -- Programming Projects.
Chapter 7 Inheritance -- 7.1 INHERITANCE BASICS -- Derived Classes -- Overriding a Method Definition -- Changing the Return Type of an Overridden Method -- Changing the Access Permission of an Overridden Method -- PITFALL: Overriding versus Overloading -- The super Constructor -- The this Constructor -- TIP: An Object of a Derived Class Has More than One Type -- PITFALL: The Terms Subclass and Superclass -- Example: An Enhanced StringTokenizer Class -- 7.2 ENCAPSULATION AND INHERITANCE -- PITFALL: Use of Private Instance Variables from the Base Class -- PITFALL: Private Methods Are Effectively Not Inherited -- Protected and Package Access -- PITFALL: Forgetting about the Default Package -- PITFALL: A Restriction on Protected Access -- 7.3 PROGRAMMING WITH INHERITANCE -- TIP: Static Variables Are Inherited -- TIP: "is a" versus "has a" -- Access to a Redefined Base Method -- PITFALL: You Cannot Use Multiple supers -- The Class Object -- The Right Way to Define equals -- TIP: getClass versus instanceof -- Chapter Summary -- Answers to Self-Test Exercises -- Programming Projects -- Chapter 8 Polymorphism and Abstract Classes -- 8.1 POLYMORPHISM -- Late Binding -- The final Modifier -- Example: Sales Records -- Late Binding with toString -- PITFALL: No Late Binding for Static Methods -- Downcasting and Upcasting -- PITFALL: Downcasting -- TIP: Checking to See Whether Downcasting Is Legitimate -- A First Look at the clone Method -- PITFALL: Sometimes the clone Method Return Type Is Object -- PITFALL: Limitations of Copy Constructors -- 8.2 ABSTRACT CLASSES -- Abstract Classes -- PITFALL: You Cannot Create Instances of an Abstract Class -- TIP: An Abstract Class Is a Type -- Chapter Summary -- Answers to Self-Test Exercises -- Programming Projects -- Chapter 9 Exception Handling -- 9.1 EXCEPTION HANDLING BASICS -- try-catch Mechanism.
Exception Handling with the Scanner Class.
|
Record Nr. | UNINA-9910154764103321 |