Java, Global Edition (7th edition) by W... | WHSmith Books
Java, Global Edition (7th edition)

Java, Global Edition (7th edition)

By: Walter Savitch (author)Mixed Media

Only 1 in stock

£56.99 RRP £59.99  You save £3.00 (5%) With FREE Saver Delivery

Description

Java: An Introduction to Problem Solving and Programming, 7e, is ideal for introductory Computer Science courses using Java, and other introductory programming courses in departments of Computer Science, Computer Engineering, CIS, MIS, IT, and Business. Students are introduced to object-oriented programming and important concepts such as design, testing and debugging, programming style, interfaces inheritance, and exception handling. The Java coverage is a concise, accessible introduction that covers key language features. Objects are covered thoroughly and early in the text, with an emphasis on application programs over applets. Teaching and Learning ExperienceThis program presents a better teaching and learning experience-for you and your students. A Concise, Accessible Introduction to Java: Key Java language features are covered in an accessible manner that resonates with introductory programmers. Tried-and-true Pedagogy: Numerous case studies, programming examples, and programming tips are used to help teach problem-solving and programming techniques. Flexible Coverage that Fits your Course: Flexibility charts and optional graphics sections allow instructors to order chapters and sections based on their course needs. Instructor and Student Resources that Enhance Learning: Resources are available to expand on the topics presented in the text.

Contents

Chapter 1 Introduction to Computers and Java 11.1 COMPUTER BASICS 2Hardware and Memory 3Programs 6Programming Languages, Compilers, and Interpreters 7Java Bytecode 9Class Loader 111.2 A SIP OF JAVA 12History of the Java Language 12Applications and Applets 13A First Java Application Program 14Writing, Compiling, and Running a Java Program 191.3 PROGRAMMING BASICS 21Object-Oriented Programming 21Algorithms 25Testing and Debugging 27Software Reuse 281.4 GRAPHICS SUPPLEMENT 30A Sample Graphics Applet 30Size and Position of Figures 32Drawing Ovals and Circles 34Drawing Arcs 35Running an Applet 37Chapter 2 Basic Computation 472.1 VARIABLES AND EXPRESSIONS 48Variables 49Data Types 51Java Identifiers 53Assignment Statements 55Simple Input 58Simple Screen Output 60Constants 60Named Constants 62Assignment Compatibilities 63Type Casting 65Arithmetic Operators 68Parentheses and Precedence Rules 71Specialized Assignment Operators 72Case Study: Vending Machine Change 74Increment and Decrement Operators 79More About the Increment and Decrement Operators 802.2 THE CLASS STRING 81String Constants and Variables 81Concatenation of Strings 82String Methods 83String Processing 85Escape Characters 88The Unicode Character Set 892.3 KEYBOARD AND SCREEN I/O 91Screen Output 91Keyboard Input 94Other Input Delimiters (Optional) 99Formatted Output with printf (Optional) 1012.4 DOCUMENTATION AND STYLE 103Meaningful Variable Names 103Comments 104Indentation 107Using Named Constants 1072.5 GRAPHICS SUPPLEMENT 109Style Rules Applied to a Graphics Applet 110Creating a Java GUI Application with the JFrame Class 110Introducing the Class JOptionPane 113Reading Input as Other Numeric Types 123Programming Example: Change-Making Programwith Windowing I/O 124Chapter 3 Flow of Control: Branching 1393.1 THE IF-ELSE STATEMENT 140The Basic if-else Statement 141Boolean Expressions 148Comparing Strings 153Nested if-else Statements 158Multibranch if-else Statements 160Programming Example: Assigning Letter Grades 162Case Study: Body Mass Index 165The Conditional Operator (Optional) 168The exit Method 1683.2 THE TYPE BOOLEAN 169Boolean Variables 170Precedence Rules 171Input and Output of Boolean Values 1743.3 THE SWITCH STATEMENT 176Enumerations 1823.4 GRAPHICS SUPPLEMENT 183Specifying a Drawing Color 184A Dialog Box for a Yes-or-No Question 187Chapter 4 Flow of Control: Loops 1994.1 JAVA LOOP STATEMENTS 200The while Statement 201The do-while Statement 204Programming Example: Bug Infestation 209Programming Example: Nested Loops 215The for Statement 217Declaring Variables within a for Statement 223Using a Comma in a for Statement (Optional) 224The for-each Statement 2264.2 PROGRAMMING WITH LOOPS 226The Loop Body 227Initializing Statements 228Controlling the Number of Loop Iterations 229Case Study: Using a Boolean Variable to End a Loop 231Programming Example: Spending Spree 233The break Statement and continue Statement in Loops(Optional) 236Loop Bugs 239Tracing Variables 241Assertion Checks 2434.3 GRAPHICS SUPPLEMENT 245Programming Example: A Multiface Applet 245The drawstring Method 250Chapter 5 Defining Classes and Methods 2675.1 CLASS AND METHOD DEFINITIONS 269Class Files and Separate Compilation 271Programming Example: Implementing a Dog Class 271Instance Variables 272Methods 275Defining void Methods 278Defining Methods That Return a Value 279Programming Example: First Try at Implementing a Species Class 284The Keyword this 288Local Variables 290Blocks 292Parameters of a Primitive Type 2935.2 INFORMATION HIDING AND ENCAPSULATION 299Information Hiding 300Precondition and Postcondition Comments 300The public and private Modifiers 302Programming Example: A Demonstration of Why InstanceVariables Should Be Private 305Programming Example: Another Implementation of a Classof Rectangles 306Accessor Methods and Mutator Methods 308Programming Example: A Purchase Class 312Methods Calling Methods 316Encapsulation 322Automatic Documentation with javadoc 325UML Class Diagrams 3265.3 OBJECTS AND REFERENCES 327Variables of a Class Type 328Defining an equals Method for a Class 333Programming Example: A Species Class 337Boolean-Valued Methods 340Case Study: Unit Testing 342Parameters of a Class Type 344Programming Example: Class-Type Parameters VersusPrimitive-Type Parameters 3485.4 GRAPHICS SUPPLEMENT 352The Graphics Class 352Programming Example: Multiple Faces, but with a Helping Method 354The Graphics2D Class and the Java2DTM API 358The init Method 360Adding Labels to an Applet 361Chapter 6 More About Objects and Methods 3836.1 CONSTRUCTORS 383Defining Constructors 385Calling Methods from Constructors 394Calling a Constructor from Other Constructors (Optional) 3976.2 STATIC VARIABLES AND STATIC METHODS 399Static Variables 399Static Methods 400Dividing the Task of a main Method into Subtasks 407Adding a main Method to a Class 408The Math Class 410Wrapper Classes 4136.3 WRITING METHODS 419Case Study: Formatting Output 419Decomposition 425Addressing Compiler Concerns 426Testing Methods 4286.4 OVERLOADING 430Overloading Basics 430Overloading and Automatic Type Conversion 433Overloading and the Return Type 436Programming Example: A Class for Money 4386.5 INFORMATION HIDING REVISITED 445Privacy Leaks 4456.6 ENUMERATION AS A CLASS 4496.7 PACKAGES 451Packages and Importing 452Package Names and Directories 453Name Clashes 4566.8 GRAPHICS SUPPLEMENT 457Adding Buttons 457Event-Driven Programming 459Programming Buttons 459Programming Example: A Complete Applet with Buttons 463Adding Icons 466Changing Visibility 468Programming Example: An Example of Changing Visibility 468Chapter 7 Arrays 4917.1 ARRAY BASICS 493Creating and Accessing Arrays 494Array Details 497The Instance Variable length 500More About Array Indices 503Initializing Arrays 5067.2 ARRAYS IN CLASSES AND METHODS 508Case Study: Sales Report 508Indexed Variables as Method Arguments 516Entire Arrays as Arguments to a Method 519Arguments for the Method main 520Array Assignment and Equality 521Methods That Return Arrays 5247.3 PROGRAMMING WITH ARRAYS AND CLASSES 528Programming Example: A Specialized List Class 528Partially Filled Arrays 5367.4 SORTING AND SEARCHING ARRAYS 538Selection Sort 538Other Sorting Algorithms 542Searching an Array 5447.5 MULTIDIMENSIONAL ARRAYS 545Multidimensional-Array Basics 546Multidimensional-Array Parameters and Returned Values 549Java's Representation of Multidimensional Arrays 552Ragged Arrays (Optional) 553Programming Example: Employee Time Records 5557.6 GRAPHICS SUPPLEMENT 561Text Areas and Text Fields 561Programming Example: A Question-and-Answer Applet 561The Classes JTextArea and JTextField 564Drawing Polygons 566Chapter 8 Inheritance, Polymorphism, andInterfaces 5898.1 INHERITANCE BASICS 590Derived Classes 592Overriding Method Definitions 596Overriding Versus Overloading 597The final Modifier 597Private Instance Variables and Private Methods of a Base Class 598UML Inheritance Diagrams 6008.2 PROGRAMMING WITH INHERITANCE 603Constructors in Derived Classes 603The this Method-Again 605Calling an Overridden Method 605Programming Example: A Derived Class of a Derived Class 606Another Way to Define the equals Methods in Undergraduate 611Type Compatibility 611The Class Object 616A Better equals Method 6188.3 POLYMORPHISM 620Dynamic Binding and Inheritance 620Dynamic Binding with toString 6238.4 INTERFACES AND ABSTRACT CLASSES 625Class Interfaces 625Java Interfaces 626Implementing an Interface 627An Interface as a Type 629Extending an Interface 632Case Study: Character Graphics 633Case Study: The Comparable Interface 646Abstract Classes 6508.5 GRAPHICS SUPPLEMENT 652The Class JApplet 653The Class JFrame 653Window Events and Window Listeners 656The ActionListener Interface 658What to Do Next 658Chapter 9 Exception Handling 6719.1 BASIC EXCEPTION HANDLING 672Exceptions in Java 673Predefined Exception Classes 6839.2 DEFINING yOUR OWN EXCEPTION CLASSES 6859.3 MORE ABOUT EXCEPTION CLASSES 695Declaring Exceptions (Passing the Buck) 695Kinds of Exceptions 698Errors 700Multiple Throws and Catches 701The finally Block 707Rethrowing an Exception (Optional) 708Case Study: A Line-Oriented Calculator 7099.4 GRAPHICS SUPPLEMENT 721Exceptions in GUIs 721Programming Example: A JFrame GUI Using Exceptions 721Chapter 10 Streams, File I/O, and Networking 73910.1 AN OVERVIEW OF STREAMS AND FILE I/O 741The Concept of a Stream 741Why Use Files for I/O? 742Text Files and Binary Files 74210.2 TEXT-FILE I/O 744Creating a Text File 744Appending to a Text File 750Reading from a Text File 75210.3 TECHNIQUES FOR ANY FILE 755The Class File 755Programming Example: Reading a File Namefrom the Keyboard 755Using Path Names 757Methods of the Class File 758Defining a Method to Open a Stream 760Case Study: Processing a Comma-Separated Values File 76210.4 BASIC BINARY-FILE I/O 765Creating a Binary File 765Writing Primitive Values to a Binary File 767Writing Strings to a Binary File 770Some Details About writeUTF 771Reading from a Binary File 772The Class EOFException 778Programming Example: Processing a File of Binary Data 78010.5 BINARY-FILE I/O WITH OBJECTS AND ARRAYS 785Binary-File I/O with Objects of a Class 785Some Details of Serialization 789Array Objects in Binary Files 79010.6 NETWORK COMMUNICATION WITH STREAMS 79310.7 GRAPHICS SUPPLEMENT 799Programming Example: A JFrame GUI for Manipulating Files 799Chapter 11 Recursion 82111.1 THE BASICS OF RECURSION 822Case Study: Digits to Words 826How Recursion Works 830Infinite Recursion 834Recursive Methods Versus Iterative Methods 836Recursive Methods That Return a Value 83811.2 PROGRAMMING WITH RECURSION 842Programming Example: Insisting That User Input Be Correct 842Case Study: Binary Search 844Programming Example: Merge Sort-A Recursive Sorting Method 852Chapter 12 Dynamic Data Structures and Generics 86912.1 ARRAY-BASED DATA STRUCTURES 871The Class ArrayList 872Creating an Instance of ArrayList 872Using the Methods of ArrayList 874Programming Example: A To-Do List 878Parameterized Classes and Generic Data Types 88112.2 THE JAVA COLLECTIONS FRAMEWORK 881The Collection Interface 881The Class HashSet 882The Map Interface 884The Class HashMap 88412.3 LINKED DATA STRUCTURES 887The Class LinkedList 887Linked Lists 888Implementing the Operations of a Linked List 891A Privacy Leak 898Inner Classes 899Node Inner Classes 900Iterators 900The Java Iterator Interface 912Exception Handling with Linked Lists 912Variations on a Linked List 914Other Linked Data Structures 91612.4 GENERICS 917The Basics 917Programming Example: A Generic Linked List 920APPENDICES1 Getting Java 9412 Running Applets 9423 Protected and Package Modifiers 9444 The DecimalFormat Class 945Other Pattern Symbols 9465 Javadoc 949Commenting Classes for Use within javadoc 949Running javadoc 9506 Differences Between C++ and Java 952Primitive Types 952Strings 952Flow of Control 952Testing for Equality 953main Method (Function) and Other Methods 953Files and Including Files 953Class and Method (Function) Definitions 954No Pointer Types in Java 954Method (Function) Parameters 954Arrays 954Garbage Collection 955Other Comparisons 9557 Unicode Character Codes 9568 Introduction to Java 8 Functional Programming 957INDEX 962

Product Details

  • ISBN13: 9781292018331
  • Format: Mixed Media
  • Number Of Pages: 1024
  • ID: 9781292018331
  • weight: 1586
  • ISBN10: 129201833X
  • edition: 7th edition

Delivery Information

  • Saver Delivery: Yes
  • 1st Class Delivery: Yes
  • Courier Delivery: Yes
  • Store Delivery: Yes

Prices are for internet purchases only. Prices and availability in WHSmith Stores may vary significantly

Close