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.

9780596009205

Head First Java

by
  • ISBN13:

    9780596009205

  • ISBN10:

    0596009208

  • Format: Paperback
  • Copyright: 2005-02-01
  • Publisher: Ingram Publisher Services, Inc.

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: $59.99 Save up to $48.25
  • Rent Book $11.74
    Add to Cart Free Shipping Icon Free Shipping

    TERM
    PRICE
    DUE
    IN STOCK USUALLY SHIPS IN 24 HOURS.
    *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

The first edition of this daring book introduced a highly interactive, multi-sensory method for learning Java that enables new programmers and non-programmers alike to pick up the fundamentals of the Java language, so they can begin to design and write Java programs quickly. The approach has been so successful that we've released several other, more specialized Head First titles into the Java market. Head First Java teaches Java basics by engaging readers on many different levels; it stimulates their abilities in pattern matching and deduction, activates auditory pathways, as well as visual pathways and deeper thought. The book even provides alternative ways to experience the book-users can read a chapter start-to-finish, or simply skim the visual story of the chapter, and still learn! Because Java 5.0, the latest version of the Java language and development platform, is a major update with many changes, the learning method in this book's new edition takes on even greater significance.

Author Biography

Kathy Sierra has been interested in learning theory since her days as a game developer (Virgin, MGM, Amblin'). More recently, she's been a master trainer for Sun Microsystems, teaching Sun's Java instructors how to teach the latest technologies to customers, and a lead developer of several Sun certification exams. Along with her partner Bert Bates, Kathy created the Head First series. She's also the original founder of the Software Development/Jolt Productivity Award-winning javaranch.com, the largest (and friendliest) all-volunteer Java community.

Bert Bates is a 20-year software developer, a Java instructor, and a co-developer of Sun's upcoming EJB exam (Sun Certified Business Component Developer). His background features a long stint in artificial intelligence, with clients like the Weather Channel, A&E Network, Rockwell, and Timken.

Table of Contents

Intro Your brain on Java
Who is this book for? xxii
What your brain is thinking xxiii
Metacognition xxv
Bend your brain into submission xxvii
What you need for this book xxviii
Technical editors xxx
Acknowledgements xxxi
Breaking the Surface
Java takes you to new places
The way Java works
2(5)
Code structure in Java
7(1)
Anatomy of a class
8(1)
The main() method
9(2)
Looping
11(2)
Conditional branching (if tests)
13(1)
Coding the ``99 bottles of beer'' app
14(2)
Phrase-o-matic
16(2)
Fireside chat: compiler vs. JVM
18(2)
Exercises and puzzles
20(8)
A Trip to Objectville
I was told there would be objects
Chair Wars (Brad the OO guy vs. Larry the procedural guy)
28(3)
Inheritance (an introduction)
31(1)
Overriding methods (an introduction)
32(2)
What's in a class? (methods, instance variables)
34(2)
Making your first object
36(2)
Using main()
38(1)
Guessing Game code
39(3)
Exercises and puzzles
42(8)
Know Your Variables
Variables come in two flavors: primitive and reference
Declaring a variable (Java cares about type)
50(1)
Primitive types (``I'd like a double with extra foam, please'')
51(2)
Java keywords
53(1)
Reference variables (remote control to an object)
54(1)
Object declaration and assignment
55(2)
Objects on the garbage-collectible heap
57(2)
Arrays (a first look)
59(4)
Exercises and puzzles
63(10)
How Objects Behave
State affects behavior, behavior affects state
Methods use object state (bark different)
73(1)
Method arguments and return types
74(3)
Pass-by-value (the variable is always copied)
77(2)
Getters and Setters
79(1)
Encapsulation (do it or risk humiliation)
80(3)
Using references in an array
83(5)
Exercises and puzzles
88(8)
Extra-Strength Methods
Let's put some muscle in our methods
Building the Sink a Dot Com game
96(2)
Starting with the Simple Dot Com game (a simpler version)
98(2)
Writing prepcode (pseudocode for the game)
100(2)
Test code for Simple Dot Com
102(1)
Coding the Simple Dot Com game
103(3)
Final code for Simple Dot Com
106(5)
Generating random numbers with Math.random()
111(1)
Ready-bake code for getting user input from the command-line
112(2)
Looping with for loops
114(3)
Casting primitives from a large size to a smaller size
117(1)
Converting a String to an int with Integer.parseInt()
117(1)
Exercises and puzzles
118(8)
Using the Java Library
Java ships with hundreds of pre-built classes
Analying the bug in the Simple Dot Com Game
126(6)
ArrayList (taking advantage of the Java API)
132(6)
Fixing the DotCom class code
138(2)
Building the real game (Sink a Dot Com)
140(4)
Prepcode for the real game
144(2)
Code for the real game
146(5)
boolean expressions
151(3)
Using the library (Java API)
154(1)
Using packages (import statements, fully-qualified names)
155(3)
Using the HTML API docs and reference books
158(3)
Exercises and puzzles
161(7)
Better Living in Objectville
Plan your programs with the future in mind
Understanding inheritance (superclass and subclass relationships)
168(2)
Designing an inheritance tree (the Animal simulation)
170(1)
Avoiding duplicate code (using inheritance)
171(1)
Overriding methods
172(5)
IS-A and HAS-A (bathtub girl)
177(3)
What do you inherit from your superclass?
180(2)
What does inheritance really buy you?
182(1)
Polymorphism (using a supertype reference to a subclass object)
183(7)
Rules for overriding (don't touch those arguments and return types!)
190(1)
Method overloading (nothing more than method name re-use)
191(1)
Exercises and puzzles
192(8)
Serious Polymorphism
Inheritance is just the beginning
Some classes just should not be instantiated
200(1)
Abstract classes (can't be instantiated)
201(2)
Abstract methods (must be implemented)
203(3)
Polymorphism in action
206(2)
Class Object (the ultimate superclass of everything)
208(3)
Taking objects out of an ArrayList (they come out as type Object)
211(2)
Compiler checks the reference type (before letting you call a method)
213(1)
Get in touch with your inner object
214(1)
Polymorphic references
215(1)
Casting an object reference (moving lower on the inheritance tree)
216(7)
Deadly Diamond of Death (multiple inheritance problem)
223(1)
Using interfaces (the best solution!)
224(6)
Exercises and puzzles
230(6)
Life and Death of an Object
Objects are born and objects die
The stack and the heap, where objects and variables live
236(1)
Methods on the stack
237(1)
Where local variables live
238(1)
Where instance variables live
239(1)
The miracle of object creation
240(1)
Constructors (the code that runs when you say new)
241(2)
Initializing the state of a new Duck
243(4)
Overloaded constructors
247(3)
Superclass constructors (constructor chaining)
250(6)
Invoking overloaded constructors using this()
256(2)
Life of an object
258(2)
Garbage Collection (and making objects eligible)
260(6)
Exercises and puzzles
266(8)
Numbers Matter
Do the Math
Math class (do you really need an instance of it?)
274(1)
static methods
275(2)
static variables
277(5)
Constants (static final variables)
282(4)
Math methods (random(), round(), abs(), etc.)
286(1)
Wrapper classes (Integer, Boolean, Character, etc.)
287(2)
Autoboxing
289(5)
Number formatting
294(7)
Date formatting and manipulation
301(6)
Static imports
307(3)
Exercises and puzzles
310(6)
Risky Behavior
Stuff happens
Making a music machine (the BeatBox)
316(3)
What if you need to call risky code?
319(1)
Exceptions say ``something bad may have happened...''
320(1)
The compiler guarantees (it checks) that you're aware of the risks
321(1)
Catching exceptions using a try/catch (skateboarder)
322(4)
Flow control in try/catch blocks
326(1)
The finally block (no matter what happens, turn off the oven!)
327(2)
Catching multiple exceptions (the order matters)
329(6)
Declaring an exception (just duck it)
335(2)
Handle or declare law
337(2)
Code Kitchen (making sounds)
339(9)
Exercises and puzzles
348(7)
A Very Graphic Story
Face it, you need to make GUIs
Your first GUI
355(2)
Getting a user event
357(1)
Implement a listener interface
358(2)
Getting a button's ActionEvent
360(3)
Putting graphics on a GUI
363(2)
Fun with paintComponent()
365(1)
The Graphics2D object
366(4)
Putting more than one button on a screen
370(6)
Inner classes to the rescue (make your listener an inner class)
376(6)
Animation (move it, paint it, move it, paint it, move it, paint it...)
382(4)
Code Kitchen (painting graphics with the beat of the music)
386(8)
Exercises and puzzles
394(6)
Work on your Swing
Swing is easy
Swing Components
400(1)
Layout Managers (they control size and placement)
401(2)
Three Layout Managers (border, flow, box)
403(1)
BorderLayout (cares about five regions)
404(4)
FlowLayout (cares about the order and preferred size)
408(3)
BoxLayout (like flow, but can stack components vertically)
411(2)
JTextField (for single-line user input)
413(1)
JTextArea (for multi-line, scrolling text)
414(2)
JCheckBox (is it selected?)
416(1)
JList (a scrollable, selectable list)
417(1)
Code Kitchen (The Big One-building the BeatBox chat client)
418(6)
Exercises and puzzles
424(7)
Saving Objects
Objects can be flattened and inflated
Saving object state
431(1)
Writing a serialized object to a file
432(1)
Java input and output streams (connections and chains)
433(1)
Object serialization
434(3)
Implementing the Serializable interface
437(2)
Using transient variables
439(2)
Deserializing an object
441(6)
Writing to a text file
447(5)
java.io.File
452(2)
Reading from a text file
454(4)
Splitting a String into tokens with split()
458(4)
CodeKitchen
462(4)
Exercises and puzzles
466(7)
Make a Connection
Connect with the outside world
Chat program overview
473(1)
Connecting, sending, and receiving
474(1)
Network sockets
475(1)
TCP ports
476(2)
Reading data from a socket (using BufferedReader)
478(1)
Writing data to a socket (using PrintWriter)
479(1)
Writing the Daily Advice Client program
480(3)
Writing a simple server
483(1)
Daily Advice Server code
484(2)
Writing a chat client
486(4)
Multiple call stacks
490(2)
Launching a new thread (make it, start it)
492(2)
The Runnable interface (the thread's job)
494(1)
Three states of a new Thread object (new, runnable, running)
495(1)
The runnable-running loop
496(1)
Thread scheduler (it's his decision, not yours)
497(4)
Putting a thread to sleep
501(2)
Making and starting two threads
503(2)
Concurrency issues: can this couple be saved?
505(1)
The Ryan and Monica concurrency problem, in code
506(4)
Locking to make things atomic
510(1)
Every object has a lock
511(1)
The dreaded ``Lost Update'' problem
512(2)
Synchronized methods (using a lock)
514(2)
Deadlock!
516(2)
Multithreaded ChatClient code
518(2)
Ready-bake SimpleChatServer
520(4)
Exercises and puzzles
524(9)
Data Structures
Sorting is a snap in Java
Collections
533(1)
Sorting an ArrayList with Collections.sort()
534(6)
Generics and type-safety
540(7)
Sorting things that implement the Comparable interface
547(5)
Sorting things with a custom Comparator
552(5)
The collection API---lists, sets, and maps
557(2)
Avoiding duplicates with HashSet
559(1)
Overriding hashCode() and equals()
560(7)
HashMap
567(7)
Using wildcards for polymorphism
574(2)
Exercises and puzzles
576(6)
Release Your Code
It's time to let go
Deployment options
582(2)
Keep your source code and class files separate
584(1)
Making an executable JAR (Java ARchives)
585(1)
Running an executable JAR
586(1)
Put your classes in a package!
587(2)
Packages must have a matching directory structure
589(1)
Compiling and running with packages
590(1)
Compiling with -d
591(1)
Making an executable JAR (with packages)
592(5)
Java Web Start (JWS) for deployment from the web
597(3)
How to make and deploy a JWS application
600(1)
Exercises and puzzles
601(13)
Distributed Computing
Being remote doesn't have to be a bad thing
Java Remote Method Invocation (RMI), hands-on, very detailed
614(11)
Servlets (a quick look)
625(6)
Enterprise JavaBeans (EJB), a very quick look
631(1)
Jini, the best trick of all
632(4)
Building the really cool universal service browser
636(12)
The End
648(2)
Appendix A
The final Code Kitchen project
BeatBoxFinal (client code)
650(7)
MusicServer (server code)
657(3)
Appendix B
The Top Ten Things that didn't make it into the book
Top Ten List
660(17)
Index 677

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