9780763737207

Java 5: Objects First

by
  • ISBN13:

    9780763737207

  • ISBN10:

    0763737208

  • Edition: 1st
  • Format: Paperback
  • Copyright: 2006-02-15
  • Publisher: Jones & Bartlett

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $232.95 Save up to $23.29
  • Rent Book $209.66
    Add to Cart Free Shipping

    TERM
    PRICE
    DUE

Supplemental Materials

What is included with this book?

  • 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 Rental copy of this book is 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.

Summary

True to its name, Java 5: Objects First presents object-oriented concepts right from the start. The text places significant emphasis on patterns, their associated solutions, and how to recognize and modify them. Its conversational, user-friendly style and numerous programming exercises aid students in their comprehension and retention of the material presented. Additional resources, including instructor's PowerPoint Lecture Slides, solutions to all exercises, and Student Lecture Companion, are also available.

Table of Contents

Introduction
1(30)
A Single Computer
2(2)
Networks
4(1)
The World Wide Web
5(1)
Software
5(1)
Levels of Programming
6(3)
a ← b + c in a High-Level Language
9(1)
a ← b + c in Assembly Language
10(1)
a ← b + c in Machine Language
10(2)
The Edit-Compile-Run Loop
12(3)
Levels of Users and Programmers
15(1)
The Software Life Cycle
16(2)
Change Is Inevitable: Maintenance Is the Costliest Activity
18(1)
Programming Paradigms
19(1)
The First Paradigm: Spaghetti Code (1945--1975)
20(1)
The Second Paradigm: Structured Programming (1970--1995)
20(2)
The Third Paradigm: Object-Oriented Programming (1995--present)
22(1)
Human Reactions to Paradigm Change
23(8)
Chapter Summary
24(1)
Terminology Introduced in This Chapter
25(1)
Exercises
26(5)
Classes and Objects
31(14)
Modeling a Bank
32(3)
Person and Employee
35(2)
Features of the OO Paradigm
37(1)
Modeling a Section of Students
38(2)
Modeling Complex Numbers
40(1)
Conventions
41(1)
The Road Ahead
42(3)
Chapter Summary
42(1)
Terminology Introduced in This Chapter
43(1)
Exercises
43(2)
Using Predefined Classes and Objects
45(36)
What Java Provides
46(1)
Class Print Stream and Instance System.out
46(1)
Using Java
47(1)
A First Java Program
48(2)
Action Statements
50(1)
Boilerplate
50(2)
Comments
52(1)
White Space
53(1)
File Names and Class Names
54(2)
Using a Template File---Blank.java
56(2)
Methods for Class PrintStream
58(1)
Overloading
59(1)
There's More Than One Way to Solve a Problem
59(1)
GUI: Java's Graphics Libraries
60(1)
GUI: Coordinates and Colors
61(2)
GUI: Opening a JFrame
63(2)
GUI: Drawing Geometrical Shapes
65(4)
GUI: Displaying a JPEG Image
69(3)
GUI: Diagonals
72(9)
Chapter Summary
73(1)
Terminology Introduced in This Chapter
74(1)
Exercises
74(7)
Using Class String
81(32)
Declarations
82(1)
String Literals
83(1)
Assignment Statements
84(3)
Objects and References
87(2)
Java Is a Strongly Typed Language
89(1)
The Empty String
90(2)
The Uninitialized String Variable and null
92(1)
Signatures, Prototypes, and Return Types
93(1)
Methods with a Non-void Return Type
94(1)
Methods with a void Return Type
95(1)
Overloading Depends on the Signature, Not the Prototype
96(1)
Class String---Methods That Return Strings
97(2)
Cascading and Composition of Methods
99(2)
Constructors and new
101(2)
A Shortcut for String Concatenation
103(1)
Right-Hand Side of an Assignment, Revisited
103(1)
Other Methods of the Class String
103(1)
GUI: JLabels and JTextFields
104(9)
Chapter Summary
108(1)
Terminology Introduced in This Chapter
109(1)
Exercises
109(4)
Output and Input
113(22)
Characteristics of Disk Files
114(1)
Methods of Class File
115(4)
Writing to the Monitor
119(1)
Writing to a Disk File
119(3)
Reading from a Disk File
122(2)
Reading Past the End of a File
124(1)
Reading from the Keyboard
124(2)
Patterns and Reuse
126(2)
Practice!
128(7)
Chapter Summary
129(1)
Terminology Introduced in This Chapter
129(1)
Exercises
130(5)
Defining New Classes
135(76)
Our First Class Definition
136(4)
Overloading a Method
140(2)
Introducing Instance Variables
142(9)
Schemes for Naming Constructor Parameters
151(2)
Getters and Setters
153(5)
Problems with Sharing Data Structure
158(6)
Last Words on Setters and Getters
164(1)
What If a Parameter Is a User-Defined Object?
165(4)
What If the Return Type Is a User-Defined Object?
169(5)
Schemes for Returning Objects from Methods
174(1)
The toString Method
175(6)
Reading Objects Using static read Methods
181(7)
Aspects of static
188(1)
Designing and Implementing Classes
189(4)
Default Constructors and main Methods
193(3)
Command-Line Arguments
196(15)
Chapter Summary
199(1)
Terminology Introduced in This Chapter
200(1)
Exercises
200(11)
Integer Datatypes
211(98)
Integers and Integer Types
212(2)
Read an int and Print Its Square
214(3)
String Methods Involving Integers
217(6)
Arithmetic Operators for Integers
223(2)
Precedence and Parentheses
225(3)
Shortcuts for Arithmetic Expressions and Statements
228(1)
How Primitive Datatypes Differ from Objects
229(1)
EggShipment: Gross, Dozen, Single
230(5)
Arithmetic with EggShipments
235(5)
Complex Numbers: Mathematical Preliminaries
240(1)
Reading and Printing Complex Numbers
241(3)
Arithmetic Operations on Complex Numbers
244(7)
Class Rectangle
251(4)
Counting Rectangles---static Again!
255(5)
Generating Sequential ID Numbers
260(3)
Fractions
263(1)
Converting Strings to ints
264(3)
Converting ints to Strings
267(3)
Pretty-Printing Integer Values
270(4)
Casting
274(1)
Integer Wraparound
275(2)
How Scanner Works
277(5)
GUI: Accept an int and Print Its Square
282(2)
GUI: Adding Buttons to a JFrame
284(2)
GUI: Add ActionListeners to the Buttons
286(2)
GUI: Counting Button Clicks
288(21)
Chapter Summary
289(2)
Terminology Introduced in This Chapter
291(1)
Exercises
291(18)
Boolean Variables
309(22)
Literals
310(1)
Relational Operators and Numeric Types
311(2)
Logical Operators
313(1)
Precedence
314(1)
Equality and Objects
315(3)
Predicates---Predefined and User-Defined
318(3)
Odd and Even
321(2)
static Predicates
323(1)
DeMorgan's Laws
323(1)
Experiments to Test the Behavior of Logical Operators
324(7)
Chapter Summary
326(1)
Terminology Introduced in This Chapter
326(1)
Exercises
327(4)
char
331(12)
Literals of Type char
331(1)
chars Sizes in Bits
332(1)
String Methods Involving chars
332(3)
Strings and chars
335(1)
Comparing chars with Relational Operators
335(1)
Is a char a Digit?
336(2)
Arithmetic with chars
338(1)
Converting Between chars and ints
339(4)
Chapter Summary
339(1)
Terminology Introduced in This Chapter
340(1)
Exercises
340(3)
Floating-Point Datatypes
343(34)
Java's Floating-Point Datatypes
344(1)
Floating-Point Literals
345(1)
Read a double and Print Its Square
346(1)
Pretty-Printing Floating-Point Numbers
347(2)
Arithmetic with Floating-Point Numbers
349(1)
Mixed-Mode Arithmetic
350(1)
Precedence and Parentheses
350(1)
Shortcuts
351(1)
Methods from Class Math
351(1)
Floating-Point Constants
352(1)
Converting Between Integers and Floating-Point
353(1)
Testing for Equality of Floating-Point Numbers
354(2)
Class Circle
356(3)
Unnecessary Instance Variables
359(2)
grow, shrink, report
361(3)
Comparing Circles
364(2)
A static Variable---taxRate
366(3)
Converting Strings to doubles
369(2)
Converting doubles to Strings
371(1)
MIN_VALUE and MAX_VALUE
371(6)
Chapter Summary
373(1)
Terminology Introduced in This Chapter
374(1)
Exercises
374(3)
Conditional Execution
377(72)
Things to Validate
378(1)
Our First if
379(4)
The if Statement
383(2)
Validating the radius of a Circle
385(5)
Properties of ints
390(2)
Classifying Temperature: Using if
392(5)
Improving the static read Method
397(7)
Changing a char from Lowercase to Uppercase
404(1)
Computing Pay with Overtime
405(4)
The if-else Statement
409(3)
Classifying Temperature: Using if-else
412(2)
Multiway Branching: The Letter Grade Problem
414(2)
Properties of a char
416(4)
Nested ifs and Dangling elses
420(3)
Stylistic Considerations
423(3)
An Improved to String for Class Complex
426(4)
The switch Statement
430(2)
GUI: Check Boxes and Three-Bit Integers
432(2)
GUI: Radio Buttons
434(15)
Chapter Summary
436(1)
Terminology Introduced in This Chapter
437(1)
Exercises
437(12)
Testing, Coding, and Debugging
449(36)
Why We Test
449(1)
Select Test Cases Before You Write the Code
450(1)
Selecting Good Test Cases
451(2)
Regression Testing
453(1)
Testing Alternatives
453(3)
Type in Test Cases: Visually Check the Outputs
456(1)
Driver Contains Inputs: Visually Check the Outputs
457(2)
Driver Contains I/O: Visually Check
459(2)
Driver Contains I/O: Automatically Check
461(2)
Reporting Options
463(1)
static Automatic Test Method
463(4)
Testing the times Method of Class Complex
467(2)
Coding Tips
469(3)
Debugging
472(3)
Seeking Help: How to Document Errors
475(1)
Learning Novel Language Constructs
476(1)
Keep the Interface but Improve the Implementation
477(1)
Style Sheets
477(8)
Chapter Summary
478(1)
Terminology Introduced in This Chapter
479(1)
Exercises
479(6)
Loops and Files
485(108)
Collections and Their Characteristics
486(2)
A Selection of Collections
488(1)
An Initial Set of Programming Patterns
489(2)
Files as Collections
491(1)
The while Loop
492(1)
The Read-Process Loop
493(2)
Print the Complex Numbers in a File
495(3)
Patterns for Counting
498(3)
Patterns for Accumulating
501(8)
Computing the Average
509(3)
More About nextInt and nextLine
512(1)
Section---Implemented as a File of Students
513(4)
howMany
517(4)
any and all
521(10)
Finding Extremes
531(5)
Is a Sequence in Order?
536(3)
Pattern: New File(s)
539(1)
Pattern: Two Files In
540(6)
Some Miscellaneous Problems
546(4)
Generating Integer Sequences with while
550(3)
Signaling End-of-File with a Sentinel
553(2)
More about while
555(1)
The for Loop
556(5)
End-of-File
561(3)
Reading the Same File Twice
564(3)
GUI: JOptionPane and Dialog Boxes
567(1)
GUI: Graphics and Loops
568(25)
Chapter Summary
568(1)
Terminology Introduced in This Chapter
569(1)
Exercises
570(23)
Arrays
593(126)
Arrays as Collections
594(1)
An Array of Three ints
594(3)
An Array of 10 ints
597(2)
Given a File of ints, Read Them into an Array
599(5)
Passing Arrays and Array Elements
604(7)
Class MyString---Array of char
611(2)
Primitive Methods for MyString
613(3)
A Taxonomy of MyString Methods
616(1)
equals
617(3)
Concatenating Arrays
620(2)
Index, Contains, How Many
622(6)
MyString in, MyString out---Same Length
628(7)
Add a char at the Front or Rear
635(2)
Deleting chars
637(8)
substring
645(2)
trim
647(3)
isPrefixOf
650(1)
Section---Implemented as an Array of Student
651(5)
More Constructors and printInReverse
656(3)
Adding Students to a Section
659(2)
Finding Extrema in Section
661(4)
Sharing and Copying
665(9)
Keep and Delete
674(1)
Order!
674(8)
String [ ] args
682(1)
Array Indexing in Other Languages
683(1)
Multidimensional Arrays
684(1)
2-D Array Basics
684(2)
2-D Arrays of Numbers
686(1)
2-D Arrays of char
687(2)
2-D Arrays of boolean
689(1)
Computing Array Addresses
690(1)
Ragged Arrays
690(2)
GUI: Regular Polygons
692(1)
GUI: Checkerboard
693(26)
Chapter Summary
695(2)
Terminology Introduced in This Chapter
697(1)
Exercises
697(22)
Interfaces and Polymorphism
719(46)
The Two Meanings of ``Interface''
719(1)
Musical Instruments and the CanPlayNotes Interface
720(1)
The Comparable Interface
720(6)
Sorting Arrays of Comparable Objects
726(4)
Comparing Objects on More Than One Attribute
730(1)
Sorting Arrays of Primitive Datatypes
730(1)
Defining Our Own Interface---Talker
731(2)
Variables of Type Talker
733(1)
Arrays of Type Talker
734(1)
Polymorphism
735(4)
Before Polymorphism (The Olden Days)
739(1)
Multiple Interfaces---Scanner and Printer
740(3)
Passing Methods Using Interfaces
743(4)
Bar Graphs
747(3)
GUI: The MouseListener Interface
750(3)
GUI: The MouseMotionListener Interface
753(2)
GUI: The KeyListener Interface
755(10)
Chapter Summary
757(1)
Terminology Introduced in This Chapter
758(1)
Exercises
758(7)
Inheritance and Class Hierarchies
765(52)
Has-a and Is-a Relationships
766(2)
extends
768(1)
Inheritance Promotes Software Reuse
768(4)
Inheriting Data from a Parent Class
772(3)
Adding Data in a Subclass
775(3)
Encapsulating Data and Using Overridden Methods
778(2)
Overriding an Instance Variable
780(2)
Object Is at the Top of All Hierarchies
782(1)
Polymorphism Using Inheritance
782(2)
Miscellaneous Topics
784(3)
Implementing BetterPS as a Composition
787(1)
A Hierarchy of Animals
788(3)
Using abstract Classes
791(3)
Case Study: Persons in an Organization
794(5)
Creating a Class Hierarchy
799(3)
From UML to Java Code
802(2)
Observations on Class Hierarchies
804(1)
GUI: FlowLayout
804(2)
GUI: BorderLayout
806(11)
Chapter Summary
808(1)
Terminology Introduced in This Chapter
809(1)
Exercises
810(7)
Exceptions
817(30)
Exceptions We've Already Encountered
818(1)
Anatomy of an Exception
818(2)
Divide by Zero with a Deeper Stack
820(2)
Exceptions Are Objects
822(1)
try and catch
823(4)
A Fail-Safe Reader of Integers
827(3)
Multiple catch Blocks
830(2)
finally
832(1)
Where Can an Exception Be Handled?
833(3)
Defining Our Own Exceptions
836(6)
Checked versus Unchecked Exceptions
842(5)
Chapter Summary
844(1)
Terminology Introduced in This Chapter
845(1)
Exercises
845(2)
Recursion
847(32)
You've Seen Recursion Before
847(1)
Recursive Definitions and Closed Forms
848(1)
Animating Recursive Factorial
849(1)
Infinite Recursion and Stack Frames
850(4)
Evaluating a Recursive Call with Hand-Tracing
854(2)
Making Java Trace for Us
856(3)
Recursive Primitives for MyString
859(4)
Recursive Versions of MyString Methods
863(3)
Finding Square Roots with Recursive Bisection
866(3)
Ackermann's Function Grows Very Quickly
869(1)
The Fibonacci Method Can Exhaust Our Patience
870(1)
Recursion: Past, Present, Future
870(9)
Chapter Summary
872(1)
Terminology Introduced in This Chapter
873(1)
Exercises
873(6)
Numerical and Other Algorithms
879(36)
Linear Search
879(2)
Binary Search
881(3)
Sorting
884(1)
Aside, Swapping
885(1)
Selection Sort
886(4)
Some Predicates with Integers
890(1)
Converting Integers to Strings
890(4)
Parsing Numbers
894(2)
Problems in Number Theory
896(1)
Easy String Problems
897(1)
Substring and Matching
897(2)
Ciphers
899(1)
GUI: Introducing Timer
899(2)
GUI: An Oscillator
901(14)
Chapter Summary
903(1)
Terminology Introduced in This Chapter
903(1)
Exercises
904(11)
Appendix 1 Style Sheet 915(4)
Appendix 2 Reserved Words 919(2)
Appendix 3 Printable Characters 921(2)
Appendix 4 Operator Precedence 923(2)
Appendix 5 Increment and Decrement Operators 925(4)
Appendix 6 Conditional Operator---?: 929(2)
Appendix 7 Enhanced for Loop 931(2)
Appendix 8 vararg---Variable Length Argument Lists 933(2)
Appendix 9 Enumerated Types---enum 935(4)
Appendix 10 ArrayList 939(8)
Appendix 11 Wrappers, Boxing, Unboxing 947(2)
Appendix 12 javadoc 949(8)
Index 957

Rewards Program

Write a Review