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.

9780764568589

JavaTM 2 For Dummies®, 2nd Edition

by
  • ISBN13:

    9780764568589

  • ISBN10:

    0764568582

  • Edition: 2nd
  • Format: Paperback w/CD
  • Copyright: 2004-08-01
  • Publisher: For Dummies
  • 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: $29.99

Summary

This updated bestseller covers programming essentials for the newest version of Java, the popular platform-independent, object-oriented programming languageThe material is fully updated and focuses on the new Java SDK 1.5, addressing the needs of new or inexperienced Java developersThe fun and easy writing style walks readers through Java syntax basics and helps them write their first programShows readers how to create basic Java objects and figure out when they can reuse existing codeThe new edition is also modified to better address the readers who may have some programming knowledge, but who are new to Java

Author Biography

Barry Burd is the author of Java 2 For Dummies, Beginning Programming with Java For Dummies, and Java & XML For Dummies, and a computer science professor at Drew University.

Table of Contents

Introduction 1(1)
How to Use This Book
1(1)
Conventions Used in This Book
1(1)
What You Don't Have to Read
2(1)
Foolish Assumptions
3(1)
How This Book Is Organized
4(2)
Part I: Getting Started
4(1)
Part II: Writing Your Own Java Programs
4(1)
Part III: Working with the Big Picture: Object-Oriented Programming
4(1)
Part IV: Savvy Java Techniques
5(1)
Part V: The Part of Tens
5(1)
Part VI: Appendixes
5(1)
Bonus Chapters on the CD-ROM!
5(1)
Icons Used in This Book
6(1)
Where to Go from Here
7(2)
Part I: Getting Started
9(60)
All about Java
11(12)
What You Can Do with Java
12(1)
Why You Should Use Java
13(1)
Getting Perspective: Where Java Fits In
14(1)
Object-Oriented Programming (OOP)
15(7)
Object-oriented languages
16(1)
Objects and their classes
17(1)
What's so good about an object-oriented language?
18(2)
Refining your understanding of classes and objects
20(2)
What's Next?
22(1)
Running Canned Java Programs
23(20)
Downloading and Installing the Java Software Development Kit (SDK)
23(7)
Downloading Java
25(2)
Installing Java on your computer
27(3)
Preparing to Use an Integrated Development Environment
30(4)
JCreator
31(1)
Running JCreator for the first time
31(3)
Running Java Programs
34(9)
Running a text-based program
34(4)
Running a GUI on its own
38(1)
Running a GUI on a Web page (a Java applet)
39(4)
Using the Basic Building Blocks
43(26)
Speaking the Java Language
43(5)
The grammar and the common names
44(1)
The words in a Java program
45(3)
Checking Out Java Code for the First Time
48(1)
Understanding the Simple Java Program
49(9)
The Java class
49(1)
The Java method
50(2)
The main method in a program
52(1)
How you finally tell the computer to do something
53(2)
Curly braces
55(3)
And Now, a Few Comments
58(6)
Adding comments to your code
58(3)
What's Barry's excuse?
61(1)
Finding javadoc pages
61(1)
Using comments to experiment with your code
62(2)
Typing Your Own Code
64(5)
Part II: Writing Your Own Java Programs
69(70)
Making the Most of Variables and Their Values
71(28)
Varying a Variable
71(2)
Assignment Statements
73(1)
Understanding the Types of Values That Variables May Have
74(3)
An Import Declaration
77(1)
Displaying Text
78(1)
Numbers without Decimal Points
78(2)
Combining Declarations and Initializing Variables
80(1)
The Atoms: Java's Primitive Types
81(4)
The char type
82(2)
The boolean type
84(1)
The Molecules and Compounds: Reference Types
85(4)
Creating New Values by Applying Operators
89(10)
Initialize once, assign often
92(1)
The increment and decrement operators
92(4)
Assignment operators
96(3)
Controlling Program Flow with Decision-Making Statements
99(22)
Making Decisions (Java if Statements)
100(7)
Guess the number
100(1)
She controlled keystrokes from the keyboard
101(1)
Creating randomness
102(1)
The if statement
103(1)
The double equal sign
104(1)
Brace yourself
105(1)
Indenting if statements in your code
105(1)
Elseless in Ifrica
106(1)
Forming Conditions with Comparisons and Logical Operators
107(6)
Comparing numbers; comparing characters
107(1)
Comparing objects
108(3)
Importing everything in one fell swoop
111(1)
Java's logical operators
111(2)
Building a Nest
113(2)
Choosing among Many Alternatives (Java switch Statements)
115(6)
Your basic switch statement
116(3)
To break or not to break
119(2)
Controlling Program Flow with Loops
121(18)
Repeating Instructions Over and Over Again (Java while Statements)
122(3)
Repeating a Certain Number of Times (Java for Statements)
125(4)
The anatomy of a for statement
126(2)
The world premiere of ``Al's All Wet''
128(1)
Repeating Until You Get What You Want (Java do Statements)
129(5)
Reading a single character
132(1)
File handling in Java
133(1)
Variable declarations and blocks
133(1)
Loops Made Painless
134(5)
Don't need no stinking counters
134(2)
Grouping things together
136(1)
Anatomy of an enhanced for loop
137(2)
Part III: Working With the Big Picture: Object-Oriented Programming
139(80)
Thinking in Terms of Classes and Objects
141(28)
Defining a Class (What It Means to Be an Account)
142(5)
Declaring variables and creating objects
144(2)
Initializing a variable
146(1)
Using variables
146(1)
Compiling and Running More Than One Class
147(1)
Defining a Method within a Class (Displaying an Account)
148(4)
An account that displays itself
150(1)
The display method's header
151(1)
Sending Values to and from Methods (Calculating Interest)
152(10)
Passing a value to a method
155(1)
Returning a value from the getInterest method
156(2)
Making numbers look good
158(4)
Hiding Details with Accessor Methods (Why You Shouldn't Micromanage a Bank Teller)
162(7)
Good programming
162(3)
Public lives and private dreams: Making a variable name inaccessible
165(2)
Enforcing rules with accessor methods
167(2)
Saving Time and Money: Reusing Existing Code
169(30)
Defining a Class (What It Means to Be an Employee)
170(4)
The last word on employees
170(2)
Putting your class to good use
172(1)
Cutting a check
173(1)
Working with Disk Files (A Brief Detour)
174(9)
Storing data in a file
175(2)
Copying and pasting code
177(1)
Reading from a file
178(2)
Who moved my file?
180(1)
Adding directory names to your filenames
181(1)
Reading a line at a time
182(1)
Defining Subclasses (What It Means to Be a Full-Time Employee or a Part-Time Employee)
183(6)
Creating a subclass
185(3)
Creating subclasses is habit-forming
188(1)
Using Subclasses
189(6)
A program for the minimalist
189(3)
A program for the maximalist
192(3)
Overriding Existing Methods (Changing the Payments for Some of Your Employees)
195(4)
Constructing New Objects
199(20)
Defining Constructors (What It Means to Be a Temperature)
200(8)
What is a temperature?
200(2)
What you can do with a temperature
202(1)
Calling new Temperature (32.0): A case study
203(3)
enum types as first-class citizens
206(1)
Some things never change
207(1)
More Subclasses (Doing Something about the Weather)
208(7)
Building better temperatures
208(2)
Constructors for subclasses
210(1)
Using all this stuff
211(1)
The default constructor
212(2)
An invisible constructor call
214(1)
A Constructor That Does More
215(4)
Part IV: Savvy Java Techniques
219(86)
Putting Variables and Methods Where They Belong
221(28)
Defining a Class (What It Means to Be a Baseball Player)
222(6)
Another way to beautify your numbers
223(1)
Using the Player class
223(2)
Nine, count'em, nine
225(1)
Don't get all GUI on me
226(1)
Tossing an exception from method to method
227(1)
Making Static (Finding the Team Average)
228(7)
Why is there so much static?
230(1)
Displaying the overall team average
231(2)
Static is old hat
233(1)
Could cause static; handle with care
234(1)
Experiments with Variables
235(6)
Putting a variable in its place
236(2)
Telling a variable where to go
238(3)
Passing Parameters
241(8)
Pass by value
241(2)
Returning a result
243(1)
Pass by reference
244(2)
Returning an object from a method
246(1)
Epilogue
247(2)
Using Arrays and Collections to Juggle Values
249(30)
Getting Your Ducks All in a Row
249(12)
Creating an array in two easy steps
251(1)
Storing values
252(3)
Tab stops and other special things
255(1)
Using an array initializer
255(1)
Stepping through an array with the enhanced for loop
256(1)
Searching
257(4)
Arrays of Objects
261(6)
Using the Room class
262(3)
Yet another way to beautify your numbers
265(1)
The conditional operator
266(1)
Command Line Arguments
267(6)
Using command line arguments in a Java program
267(2)
Checking for the right number of command line arguments
269(1)
Setting up JCreator for command line arguments
270(3)
Using Java Collections
273(6)
Collection classes to the rescue
274(1)
Using an Array List
275(2)
Using generics (hot stuff!)
277(1)
Testing for the presence of more data
277(2)
Looking Good When Things Take Unexpected Turns
279(26)
Handling Exceptions
280(16)
The parameter in a catch clause
284(1)
Exception types
285(1)
Who's going to catch the exception?
286(7)
Throwing caution to the wind
293(1)
Doing useful things
294(1)
Our friends, the good exceptions
295(1)
Handle an Exception or Pass the Buck
296(5)
Finishing the Job with a finally Clause
301(4)
Part V: The Part of Tens
305(14)
Ten Ways to Avoid Mistakes
307(6)
Putting Capital Letters Where They Belong
307(1)
Breaking Out of a switch Statement
308(1)
Comparing Values with a Double Equal Sign
308(1)
Adding Components to a GUI
308(1)
Adding Listeners to Handle Events
309(1)
Defining the Required Constructors
309(1)
Fixing Non-Static References
309(1)
Staying within Bounds in an Array
310(1)
Anticipating Null Pointers
310(1)
Helping Java Find its Files
311(2)
Ten Sets of Web Resources for Java
313(6)
The Horse's Mouth
313(1)
Finding News, Reviews, and Sample Code
314(1)
Improving Your Code with Tutorials
314(1)
Finding Help on Newsgroups
314(1)
Checking the FAQs for Useful Info
315(1)
Opinions and Advocacy
315(1)
Looking for Java Jobs
315(1)
Becoming Certified in Java
316(1)
Developing Servlets
316(1)
Everyone's Favorite Sites
316(3)
Part VI: Appendixes
319(2)
Appendix A: Using the CD-ROM
321(10)
What You Can Expect to Find on the CD-ROM
321(1)
System Requirements
322(1)
Using the CD with Microsoft Windows
323(1)
Using the CD with Mac OS
324(1)
Running the Java Code That's in This Book
325(1)
Freeware, Shareware, and Just Plain Ware
326(2)
JCreator
326(1)
Adobe Acrobat Reader
327(1)
Jindent
327(1)
NetCaptor
328(1)
WinOne
328(1)
And, If You Run into Any Trouble
328(3)
Appendix B: When to Use Words Like ``public'' and ``private''
331(10)
Members versus Classes
331(1)
Access Modifiers for Members
332(6)
Default access
334(1)
Protected access
334(4)
Access Modifiers for Classes
338(3)
Index 341(20)
End-User License Agreement 361

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