did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780393974379

Java Programming From the Beginning

by
  • ISBN13:

    9780393974379

  • ISBN10:

    0393974375

  • Edition: 00
  • Format: Paperback
  • Copyright: 2000-07-13
  • Publisher: W. W. Norton & Company

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

Purchase Benefits

  • Free Shipping Icon 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.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $139.54 Save up to $41.86
  • Rent Book $97.68
    Add to Cart Free Shipping Icon Free Shipping

    TERM
    PRICE
    DUE
    USUALLY SHIPS IN 3-5 BUSINESS DAYS
    *This item is part of an exclusive publisher rental program and requires an additional convenience fee. This fee will be reflected in the shopping cart.

Supplemental Materials

What is included with this book?

Summary

Java Programming emphasizes object-oriented design, problem-solving, and good programming style, without overwhelming students with extraneous information. Assuming no prior programming experience, the book provides coverage of basic concepts in computer science as a springboard for more advanced discussion.

Table of Contents

Preface xvii
Getting Started
1(26)
What Do Computers Do?
2(3)
Hardware
3(1)
Software
3(2)
Ways of Interacting with Computers
5(5)
Graphical User Interfaces
5(3)
Text-Based Interfaces
8(2)
What Is Programming?
10(3)
A Real-World Algorithm
11(1)
Computer Algorithms
12(1)
Expressing Algorithms
12(1)
Storing Data
13(2)
Variables
14(1)
Programming Languages
15(3)
Writing and Executing a Program
17(1)
Why Java?
18(2)
The Programming Process
20(1)
What You Need to Know
21(6)
Writing Java Programs
27(58)
A Simple Java Program
28(2)
Program: Printing a Message
28(1)
Java Programs in General
29(1)
Executing a Java Program
30(4)
Entering a Java Program
31(1)
Compiling a Java Program
32(1)
Running a Java Program
33(1)
Using Multiple Windows
33(1)
Program Layout
34(5)
Comments
34(2)
Tokens
36(1)
Indentation and Brace Placement
37(2)
Using Variables
39(3)
Declaring Variables
39(1)
Initializing Variables
40(1)
Changing the Value of a Variable
41(1)
Program: Printing a Lottery Number
41(1)
Types
42(2)
Literals
43(1)
Identifiers
44(2)
Keywords
45(1)
Performing Calculations
46(6)
Operators
46(3)
Precedence and Associativity
49(1)
Assignment Operators
50(1)
Program: Converting from Fahrenheit to Celsius
51(1)
Constants
52(2)
Methods
54(4)
Methods in the Math Class
55(1)
Using the Result of a Method Call
56(2)
Input and Output
58(5)
Displaying Output on the Screen
58(1)
Escape Sequences
59(1)
Printing Multiple Items
60(1)
Obtaining Input from the User
60(1)
Packages
61(1)
Program: Converting from Fahrenheit to Celsius (Revisited)
62(1)
Case Study: Computing a Course Average
63(7)
Improving the Program
69(1)
Debugging
70(15)
Types of Errors
71(1)
Fixing Compile-Time Errors
71(1)
Fixing Run-Time Errors
72(1)
Fixing Behavioral Errors
73(1)
Using a Debugger
73(1)
Debugging Without a Debugger
73(1)
Choosing Test Data
74(11)
Classes and Objects
85(42)
Objects as Models
86(1)
Representing Objects Within a Program
87(2)
Instance Variables
87(1)
Instance Methods
88(1)
Classes
89(4)
Declaring a Class
89(1)
Declaring Instance Variables
90(1)
Declaring Instance Methods
90(1)
Method Overloading
91(1)
Declaring Constructors
91(1)
Example: An Account Class
92(1)
Creating Objects
93(1)
Calling Instance Methods
94(3)
How Instance Methods Work
95(2)
Writing Programs with Multiple Classes
97(2)
How Objects Are Stored
99(4)
The null Keyword
100(1)
Object Assignment
100(2)
Garbage
102(1)
Developing a Fraction Class
103(5)
Getters and Setters
104(1)
Writing the add Method
105(2)
Adding a toString Method
107(1)
Java's String Class
108(9)
Creating Strings
108(1)
Common String Methods
109(3)
Chaining Calls of Instance Methods
112(1)
Using + to Concatenate Strings
112(2)
Program: Decoding a Vehicle Identification Number
114(3)
Case Study: Checking an ISBN Number
117(10)
Basic Control Structures
127(54)
Performing Comparisons
128(4)
Relational Operators
128(1)
Equality Operators
129(1)
Testing Floating-Point Numbers for Equality
130(1)
Testing Objects for Equality
130(1)
Comparing Strings
131(1)
Logical Operators
132(4)
Performing the And Operation
133(1)
Performing the Or Operation
134(1)
Performing the Not Operation
134(1)
Precedence and Associativity of And, Or, and Not
135(1)
Simplifying boolean Expressions
135(1)
Simple if Statements
136(4)
Indentation
137(1)
The Empty Statement
138(1)
Blocks
139(1)
if Statements with else Clauses
140(8)
Cascaded if Statements
142(2)
Simplifying Cascaded if Statements
144(1)
Program: Flipping a Coin
144(2)
The ``Dangling else'' Problem
146(2)
The boolean Type
148(3)
Program: Flipping a Coin (Revisited)
150(1)
Loops
151(5)
Types of Loops
151(1)
The while Statement
151(2)
Blocks as Loop Bodies
153(2)
Declaring Variables in Blocks
155(1)
Example: Improving the Fraction Constructor
155(1)
Counting Loops
156(7)
Increment and Decrement Operators
158(1)
Using the Increment and Decrement Operators in Loops
159(2)
Program: Counting Coin Flips
161(2)
Exiting from a Loop: The break Statement
163(2)
Case Study: Decoding Social Security Numbers
165(4)
Debugging
169(12)
Arrays
181(40)
Creating and Using Arrays
182(6)
Creating Arrays
182(2)
Array Subscripting
184(1)
Processing the Elements in an Array
185(1)
Program: Computing an Average Score
186(2)
The for Statement
188(6)
for Statements Versus while Statements
188(2)
for Statement Idioms
190(1)
Omitting Expressions in a for Statement
191(1)
Declaring Control Variables
192(1)
Commas in for Statements
193(1)
Program: Computing an Average Score (Revisited)
193(1)
Accessing Array Elements Sequentially
194(3)
Searching for a Particular Element
195(1)
Counting Occurrences
195(1)
Finding the Largest and Smallest Elements
195(2)
Accessing Array Elements Randomly
197(2)
Program: Finding Repeated Digits in a Number
197(2)
Using Arrays as Vectors
199(1)
Scaling a Vector
199(1)
Adding Vectors
200(1)
Computing the Inner Product of Two Vectors
200(1)
Using Arrays as Databases
200(5)
Parallel Arrays
201(1)
Arrays of Objects
202(1)
Creating a Database
202(1)
Adding a Record to a Database
203(1)
Removing a Record from a Database
204(1)
Searching a Database
204(1)
Modifying a Record in a Database
204(1)
Arrays as Objects
205(3)
Resizing an Array
206(2)
Case Study: A Phone Directory
208(13)
Graphics
221(36)
Creating a Drawing
222(11)
Using Graphics Methods
223(1)
The DrawableFrame Class
223(3)
Program: Drawing a Line
226(1)
Drawing Rectangles
227(2)
Drawing Ovals
229(1)
Drawing Arcs
229(1)
Drawing Polygons
230(2)
Drawing Polylines
232(1)
Drawing in Color
233(2)
Displaying Text
235(2)
The Font Class
235(1)
Program: Displaying Text in Different Colors
236(1)
Combining Text with Graphics
237(6)
Program: Displaying a Stop Sign
238(1)
The FontMetrics Class
239(2)
Program: Obtaining Font Information
241(2)
Case Study: A Message Window
243(3)
Debugging
246(11)
Class Variables and Methods
257(42)
Class Methods Versus Instance Methods
258(3)
Class Methods
258(2)
Example: The Math Class
260(1)
Example: The System Class
260(1)
Example: The String Class
260(1)
Summary
261(1)
Writing Class Methods
261(3)
Example: A Termination Method
262(1)
Local Variables
263(1)
The return Statement
264(4)
Example: A Dollar-Formatting Method
265(1)
Conditional Expressions
266(2)
Parameters
268(6)
How Arguments Are Passed
268(3)
Array Parameters
271(1)
Program Arguments
272(1)
Program: Printing Command-Line Arguments
273(1)
Class Variables
274(4)
Declaring Class Variables
274(1)
Uses for Class Variables
275(1)
Using Class Variables as Global Variables
275(1)
Class Variables in the System Class
275(2)
Using Class Variables as Constants
277(1)
Using Class Variables to Store Data for Class Methods
277(1)
Summary
278(1)
Adding Class Variables and Methods to a Class
278(3)
Example: Modifying the DisplayText Program
279(2)
Writing Helper Methods
281(6)
Improving Clarity
282(1)
Reducing Redundancy
283(1)
The Revised CourseAverage Program
283(3)
Reusing Helper Methods
286(1)
Designing Methods
287(12)
Cohesion
287(1)
Stepwise Refinement
287(1)
Choosing Method Names
288(1)
Parameters Versus Class Variables
289(1)
Return Type
290(9)
More Control Structures
299(40)
Exceptions
300(6)
Handling Exceptions
300(1)
Variables and try Blocks
301(1)
Accessing Information About an Exception
302(1)
Terminating the Program After an Exception
302(1)
Converting Strings to Integers
303(1)
Multiple catch Blocks
304(1)
Checked Exceptions Versus Unchecked Exceptions
304(1)
Using Exceptions Properly
305(1)
The Switch Statement
306(8)
Combining Case Labels
307(1)
The default Case
308(1)
The General Form of the switch Statement
309(1)
Layout of the switch Statement
310(1)
Advantages of the switch Statement
310(1)
Limitations of the switch Statement
311(1)
The Role of the break Statement
311(1)
Program: Determining the Number of Days in a Month
312(2)
The do Statement
314(2)
The continue Statement
316(2)
Nested Loops
318(4)
Labeled break Statements
319(1)
Labeled continue Statements
320(1)
Program: Computing Interest
320(2)
Case Study: Printing a One-Month Calendar
322(5)
Debugging
327(12)
Primitive Types
339(48)
Types
340(1)
Literals
340(1)
Integer Types
341(5)
Integer Literals
343(2)
Converting Strings to Integers
345(1)
Floating-Point Types
346(7)
Floating-Point Literals
347(1)
Special Values
348(1)
The Math Class
349(4)
The char Type
353(8)
The ASCII Character Set
353(2)
The Unicode Character Set
355(1)
Escape Sequences
356(1)
Operations on Characters
356(1)
Characters Versus Strings
357(1)
The Character Class
358(3)
Type Conversion
361(9)
Implicit Conversions
361(1)
Numeric Promotion
362(1)
Conversion During Assignment
363(1)
Argument Conversion
364(1)
Casting
364(3)
Program: Encrypting a Message Using the Rot13 Technique
367(3)
Case Study: Drawing Random Circles
370(17)
Writing Classes
387(56)
Designing Classes
388(3)
Object-Oriented Analysis
389(1)
Design Issues
389(1)
Naming Classes
389(1)
Instantiable or Not?
390(1)
Mutable or Immutable?
390(1)
Choosing Instance Variables
391(4)
How Many Instance Variables?
391(1)
Public Instance Variables
392(1)
Information Hiding
393(1)
The ``Hidden Variable'' Problem
393(2)
Designing Instance Methods
395(7)
Categories of Methods
396(1)
Manager Methods
396(1)
Implementor Methods
397(1)
Access Methods
398(1)
Helper Methods
398(2)
Using Class Methods as Helpers
400(1)
Method Overloading
401(1)
The this Keyword
402(4)
Using this to Access Hidden Variables
403(1)
Using this to Call Instance Methods
403(1)
Using this as an Argument
404(1)
Using this as a Return Value
405(1)
Writing Constructors
406(3)
Using this in Constructors
406(1)
``No-Arg'' Constructors
407(1)
Constructors Versus Instance Variable Initialization
407(2)
Example: The Fraction Class
409(4)
Adding Class Variables and Methods
413(3)
Class Variables in Instantiable Classes
413(2)
Class Methods in Instantiable Classes
415(1)
Restrictions on Class Methods
416(1)
Reusing Code
416(4)
Reusing Class Methods
417(1)
Reusing Classes
418(1)
Writing Packages
419(1)
Case Study: Playing Blackjack
420(10)
Debugging
430(13)
Subclasses
443(42)
Inheritance
444(5)
Writing a Subclass
445(1)
Writing Subclass Constructors
446(2)
Illustrating Inheritance
448(1)
When Not to Use Inheritance
449(1)
The protected Access Modifier
449(3)
Uses of protected
451(1)
protected Versus private
451(1)
Overriding
452(1)
Polymorphism
453(4)
Casting Object References
455(1)
Advantages of Polymorphism
456(1)
The Object Class
457(4)
Object Methods
458(1)
The equals Method
459(1)
The toString Method
460(1)
Abstract Classes
461(4)
Example: A Shape Class
462(3)
Final Classes and Methods
465(1)
Inheritance in the Abstract Window Toolkit
466(5)
Components
467(2)
Relationships Among Component Classes
469(2)
Case Study: ``Nervous'' Shapes
471(14)
The Abstract Window Toolkit
485(56)
Overview
486(2)
Swing
486(1)
Creating a Graphical User Interface
487(1)
Frames
488(4)
Frame Methods
488(1)
Creating a Frame
489(1)
Setting the Location of a Frame
490(1)
Adding Components to a Frame
490(2)
Event Listeners
492(6)
Events
493(1)
Interfaces
493(1)
Creating Event Listeners
494(3)
Adapter Classes
497(1)
Inner Classes
498(3)
Attaching Listeners to Multiple Components
501(5)
Example: A Single Listener
502(2)
Example: Separate Listeners
504(2)
Layout
506(7)
Layout Manager Classes
506(1)
The FlowLayout Class
507(1)
The GridLayout Class
508(1)
The BorderLayout Class
509(1)
Preferred Sizes
510(1)
Panels
510(3)
Creating and Using Components
513(8)
Checkboxes
513(1)
Checkbox Groups
514(1)
Choice Menus
514(1)
Labels
515(1)
Lists
516(1)
Scrollbars
517(1)
Text Areas
518(2)
Text Fields
520(1)
Examples
521(20)
Using Labels and Text Fields: Temperature Conversion
521(3)
Using Lists and Text Areas: Showing Definitions
524(2)
Using Labels and Scrollbars: Picking Colors
526(15)
Data Structures
541(58)
Multidimensional Arrays
542(10)
Creating and Initializing a Multidimensional Array
542(2)
Subscripting a Multidimensional Array
544(1)
Processing the Elements in a Multidimensional Array
544(1)
How Multidimensional Arrays Are Stored
545(1)
Using Two-Dimensional Arrays as Matrices
546(1)
Using Two-Dimensional Arrays to Store Images
547(1)
Ragged Arrays
548(2)
Using Multidimensional Arrays as Parameters and Results
550(1)
Program: Finding the Distance Between Two Cities
551(1)
The Vector Class
552(10)
Arrays Versus Vectors
559(1)
Program: Reversing a Series of Lines
560(2)
Wrapper Classes
562(2)
Using Wrapper Classes to Create Objects
562(1)
Using the Wrapper Classes with Vectors
563(1)
Other Uses of Wrapper Classes
564(1)
Sorting
564(6)
Inserting into a Sorted Array
565(2)
Insertion Sort
567(1)
Program: Sorting a Series of Lines
568(2)
Searching
570(4)
Program: Determining Air Mileage
572(2)
Sets
574(5)
Bit Sets
575(2)
Program: Finding Primes Using the Sieve of Eratosthenes
577(2)
The StringBuffer Class
579(4)
Program: Sorting the Characters in a String
582(1)
Case Study: Finding Anagrams
583(16)
Files
599(62)
Files and Streams
600(8)
How Files Are Stored
601(1)
Text Files Versus Binary Files
602(1)
Streams
603(1)
Stream Layering
604(1)
Working with Files
605(1)
Obtaining File Names
606(1)
Buffering and Flushing
606(1)
File Pointers
607(1)
The File Class
608(5)
File Properties
609(1)
Program: Determining the Properties of a File
610(1)
Program: Listing the Files in a Directory
611(1)
File Operations
612(1)
Program: Renaming the Files in a Directory
612(1)
Reading and Writing Bytes
613(6)
Writing Bytes
613(2)
Reading Bytes
615(2)
Program: Copying a File
617(2)
Advanced Exception-Handling
619(6)
The Hierarchy of Exception Classes
619(1)
Using Multiple catch Blocks
620(2)
finally Blocks
622(1)
The throws Clause
622(1)
Program: Copying a File (Revisited)
623(2)
Reading and Writing Data Types
625(4)
Writing Data Types
625(1)
Writing Strings
626(1)
Reading Data Types
627(2)
Reading and Writing Characters
629(7)
Writing to a Text File
629(1)
Reading from a Text File
630(2)
Program: Converting Text to HTML
632(4)
Reading and Writing Objects
636(6)
The Serializable Interface
637(1)
Writing Objects
638(1)
Reading Objects
639(2)
Reading and Writing Entire Data Structures
641(1)
Case Study: A Phone Directory (Revisited)
642(19)
Appendix A Setting Up Java 661(4)
Appendix B Java Language Summary 665(16)
Appendix C Java API Summary 681(62)
Appendix D Applets 743(16)
Appendix E The jpb Package 759(6)
Bibliography 765(2)
Index 767

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 Used, Rental and eBook copies of this book are 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.

Rewards Program