Head First Java : Your Brain on Java- A Learner's Guide

by ;
Format: Paperback
Pub. Date: 2003-05-01
Publisher(s): Oreilly & Associates Inc
List Price: $42.75

Rent Book

Select for Price
There was a problem. Please try again later.

New Book

We're Sorry
Sold Out

Used Book

We're Sorry
Sold Out

eBook

We're Sorry
Not Available

How Marketplace Works:

  • This item is offered by an independent seller and not shipped from our warehouse
  • Item details like edition and cover design may differ from our description; see seller's comments before ordering.
  • Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
  • Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
  • Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.

Summary

Between Moore's law and the notion of "Internet time," we're constantly being bombarded with more and more information--most of it in the form of disorganized data. Turning this information into useful knowledge is getting harder and harder to do, and it takes time that we just don't have. The current economic situation hasn't helped either. With money spread thin, who hasn't had to take on new tasks and learn new things? And slashed training budgets mean there's little to rely on for learning except books- but learning a complex new programming language like Java from a book is no simple task. Maybe your boss is giving you two weeks to come up to speed for a project, or maybe you're ready to take that next step up in your current job, or be a more viable candidate for a new job. Whatever the reason, the onus is on you to learn. All these factors make it more important than ever to have a way to learn--fast. And that's what Head First Java does -- by exploiting the way your brain works, it compresses the time it takes to really learn. Why? Because its unique approach not only shows you what you need to know about Java syntax, it enables and encourages you to think like a Java programmer. Mastering object oriented programming requires a certain way of thinking, not just a certain way of writing code. The latest research in cognitive science, neurobiology, and educational psychology shows that learning at the deeper levels takes a lot more than text on a page. Actively combining words and pictures not only helps in understanding the subject, but in remembering it. According to some studies, an engaging, entertaining, image-rich, conversational approach actually teaches the subject better. Head First Java puts these theories into practice with a vengeance. Chock full of mind stretching exercises, memorable analogies, and stories, humor and attitude that aren't just pasted-on distractions but that are used to drive home key points and make ideas come alive, the Head First approach is as effective as it is unique. It takes a pretty unique person to have developed such an innovative way to Learn Java. Kathy Sierra has been interested in learning theory since her days as a game designer. More recently, she's been a master trainer for Sun Microsystems, teaching Sun's own instructors how to teach the latest Java technologies. She has been actively using the concepts in Head First Java to teach hundreds of trainers, developers and even non programmers. She is the founder of one of the largest Java community websites in the world, javaranch.com, and she is a member of the development team for the Sun Certified programmer exam. Bert Bates is also a long-time Java developer and trainer with extensive experience in learning theory. His background features a long stint in artificial intelligence with clients like the Weather Channel, A&E Network, Rockwell and Timken. Is Head First Java right for you? That depends. Head First Java assumes you're a programmer or at least have experience with scripting languages. It assumes that you're smart, that you're creative and open to new ideas, and that you know you're just not the type of person who wants to learn the traditional way. Take a look at the sample pages, explore the background on brain-based learning, examine the table of contents, and see for yourself how Head First Java takes learning to a whole new level. See why Tim O'Reilly says, "This is the first really new approach to computer books that I've seen in many years. I think it's going to revolutionize how programming and other complex topics are taught." Table of Content: 1) Dive In (a quick dip into Java) 2) Welcome to Objectville (intro to OO) 3) Know your Variables (understanding Java types: primitives, object references, pass-by-value) 4) How objects behave (instance variables and met

Author Biography

Kathy Sierra has been a master trainer for Sun Microsystems, and she founded one of the largest Java community web sites in the world, javaranch.com Bert Bates is a member of the development team for several of Sun's Java Certification exams.

Table of Contents

Intro
Who is this book for? xx
What your brain is thinking xxi
Metacognition xxiii
Bend your brain into submission xxv
What you need for this book xxvi
Technical editors xxviii
Acknowledgements xxix
Breaking the Surface
The way Java works
2(3)
Code structure in Java
5(1)
Anatomy of a class
6(1)
The main() method
7(1)
Looping
8(3)
Conditional branching (if tests)
11(1)
Coding the ``99 bottles of beer'' app
12(2)
Phrase-o-matic
14(2)
Fireside chat: compiler vs. JVM
16(2)
Exercises and puzzles
18(8)
A Trip to Objectville
Chair Wars (Brad the OO guy vs. Larry the procedural guy)
26(3)
Inheritance (an introduction)
29(1)
Overriding methods (an introduction)
30(2)
What's in a class? (methods, instance variables)
32(2)
Making your first object
34(2)
Using main()
36(1)
Guessing Game code
37(3)
Exercises and puzzles
40(8)
Know Your Variables
Declaring a variable (Java cares about type)
48(1)
Primitive types (``I'd like a double with extra foam, please'')
49(2)
Java keywords
51(1)
Reference variables (remote control to an object)
52(1)
Object declaration and assignment
53(2)
Objects on the garbage-collectible heap
55(2)
Arrays (a first look)
57(4)
Exercises and puzzles
61(10)
How Objects Behave
Methods use object state (bark different)
71(1)
Method arguments and return types
72(3)
Pass-by-value (the variable is always copied)
75(2)
Getters and Setters
77(1)
Encapsulation (do it or risk humiliation)
78(3)
Using references in an array
81(5)
Exercises and puzzles
86(8)
Extra-Strength Methods
Building the Sink a Dot Com game
94(2)
Starting with the Simple Dot Com game (a simpler version)
96(1)
Writing prepcode (pseudocode for the game)
97(3)
Test code for Simple Dot Com
100(1)
Coding the Simple Dot Com game
101(3)
Final code for Simple Dot Com
104(5)
Generating random numbers with Math.random()
109(1)
Ready-bake code for getting user input from the command-line
110(2)
Looping with for loops
112(2)
Casting primitives from a large size to a smaller size
114(1)
Converting a String to an int with Integer.parseInt()
114(1)
Exercises and puzzles
115(7)
Using the Java Library
Analying the bug in the Simple Dot Com Game
122(6)
ArrayList (taking advantage of the Java API)
128(6)
Fixing the DotCom class code
134(2)
Building the real game (Sink a Dot Com)
136(4)
Prepcode for the real game
140(2)
Code for the real game
142(5)
boolean expressions
147(3)
Using the library (Java API)
150(1)
Using packages (import statements, fully-qualified names)
151(3)
Using the HTML API docs and reference books
154(3)
Exercises and puzzles
157(7)
Better Living in Objectville
Understanding inheritance (superclass and subclass relationships)
164(2)
Designing an inheritance tree (the Animal simulation)
166(1)
Avoiding duplicate code (using inheritance)
167(1)
Overriding methods
168(5)
IS-A and HAS-A (bathtub girl)
173(3)
What do you inherit from your superclass?
176(2)
What does inheritance really buy you?
178(1)
Polymorphism (using a supertype reference to a subclass object)
179(7)
Rules for overriding (don't touch those arguments and return types!)
186(1)
Method overloading (nothing more than method name re-use)
187(1)
Exercises and puzzles
188(8)
Serious Polymorphism
Some classes just should not be instantiated
196(1)
Abstract classes (can't be instantiated)
197(2)
Abstract methods (must be implemented)
199(3)
Polymorphism in action
202(2)
Class Object (the ultimate superclass of everything)
204(3)
Taking objects out of an ArrayList (they come out as type Object)
207(2)
Compiler checks the reference type (before letting you call a method)
209(1)
Get in touch with your inner object
210(1)
Polymorphic references
211(1)
Casting an object reference (moving lower on the inheritance tree)
212(7)
Deadly Diamond of Death (multiple inheritance problem)
219(1)
Using interfaces (the best solution!)
220(5)
Exercises and puzzles
225(7)
Life and Death of an Object
The stack and the heap, where objects and variables live
232(1)
Methods on the stack
233(1)
Where local variables live
234(1)
Where instance variables live
235(1)
The miracle of object creation
236(1)
Constructors (the code that runs when you say new)
237(2)
Initializing the state of a new Duck
239(2)
The compiler can make a default (no-arg) constructor
241(2)
Overloaded constructors
243(3)
Superclass constructors (constructor chaining)
246(6)
Invoking overloaded constructors using this()
252(2)
Life of an object
254(2)
Garbage Collection (and making objects eligible)
256(6)
Exercises and puzzles
262(8)
Numbers Matter
Math class (do you really need an instance of it?)
270(1)
static methods
271(2)
static variables
273(5)
Constants (static final variables)
278(4)
Math methods (random(), round(), abs(), etc.)
282(1)
Wrapper classes (Integer, Boolean, Character, etc.)
283(1)
Number formatting
284(4)
Date formatting
288(3)
Exercises and puzzles
291(7)
Risky Behavior
Making a music machine (the BeatBox)
298(3)
What if you need to call risky code?
301(1)
Exceptions say ``something bad may have happened...''
302(1)
The compiler guarantees (it checks) that you're aware of the risks
303(1)
Catching exceptions using a try/catch (skateboarder)
304(4)
Flow control in try/catch blocks
308(1)
The finally block (no matter what happens, turn off the oven!)
309(2)
Catching multiple exceptions (the order matters)
311(6)
Declaring an exception (just duck it)
317(2)
Handle or declare law
319(2)
Code Kitchen (making sounds)
321(9)
Exercises and puzzles
330(7)
A Very Graphic Story
Your first GUI
337(2)
Getting a user event
339(1)
Implement a listener interface
340(2)
Getting a button's ActionEvent
342(3)
Putting graphics on a GUI
345(2)
Fun with paintComponent()
347(1)
The Graphics2D object
348(4)
Putting more than one button on a screen
352(6)
Inner classes to the rescue (make your listener an inner class)
358(6)
Animation (move it, paint it, move it, paint it, move it, paint it...)
364(4)
Code Kitchen (painting graphics with the beat of the music)
368(8)
Exercises and puzzles
376(6)
Work on your Swing
Swing Components
382(1)
Layout Managers (they control size and placement)
383(2)
Three Layout Managers (border, flow, box)
385(1)
BorderLayout (cares about five regions)
386(4)
FlowLayout (cares about the order and preferred size)
390(3)
BoxLayout (like flow, but can stack components vertically)
393(2)
JTextField (for single-line user input)
395(1)
JTextArea (for multi-line, scrolling text)
396(2)
JCheckBox (is it selected?)
398(1)
JList (a scrollable, selectable list)
399(1)
Code Kitchen (The Big One - building the BeatBox chat client)
400(6)
Exercises and puzzles
406(7)
Saving Objects
Saving object state
413(1)
Writing a serialized object to a file
414(1)
Java input and output streams (connections and chains)
415(1)
Object serialization
416(3)
Implementing the Serializable interface
419(2)
Using transient variables
421(2)
Deserializing an object
423(4)
Writing to a text file
427(5)
java.io.File
432(2)
Reading from a text file
434(4)
StringTokenizer
438(4)
CodeKitchen
442(4)
Exercises and puzzles
446(7)
Make a Connection
Chat program overview
453(1)
Connecting, sending, and receiving
454(1)
Network sockets
455(1)
TCP ports
456(2)
Reading data from a socket (using BufferedReader)
458(1)
Writing data to a socket (using PrintWriter)
459(1)
Writing the Daily Advice Client program
460(3)
Writing a simple server
463(1)
Daily Advice Server code
464(2)
Writing a chat client
466(4)
Multiple call stacks
470(2)
Launching a new thread (make it, start it)
472(1)
The Runnable interface (the thread's job)
473(2)
Three states of a new Thread object (new, runnable, running)
475(1)
The runnable-running loop
476(1)
Thread scheduler (it's his decision, not yours)
477(4)
Putting a thread to sleep
481(2)
Making and starting two threads
483(2)
Concurrency issues: can this couple be saved?
485(1)
The Ryan and Monica concurrency problem, in code
486(4)
Locking to make things atomic
490(1)
Every object has a lock
491(1)
The dreaded ``Lost Update'' problem
492(2)
Synchronized methods (using a lock)
494(2)
Deadlock!
496(2)
Multithreaded ChatClient code
498(2)
Ready-bake SimpleChatServer
500(4)
Exercises and puzzles
504(6)
Release Your Code
Deployment options
510(2)
Keep your source code and class files separate
512(1)
Making an executable JAR (Java ARchives)
513(1)
Running an executable JAR
514(1)
Put your classes in a package!
515(1)
Preventing package name conflicts
516(1)
Packages must have a matching directory structure
517(1)
Compiling and running with packages
518(1)
Compiling with -d
519(1)
Making an executable JAR (with packages)
520(5)
Java Web Start (JWS) for deployment from the web
525(2)
The .jnlp file
527(1)
How to make and deploy a JWS application
528(1)
Exercises and puzzles
529(8)
Distributed Computing
Java Remote Method Invocation (RMI), hands-on, very detailed
537(16)
Servlets (a quick look)
553(6)
Enterprise JavaBeans (EJB), a very quick look
559(1)
Jini, the best trick of all
560(4)
Building the really cool universal service browser
564(12)
The End
576(2)
Appendix A
BeatBoxFinal (client code)
578(7)
MusicServer (server code)
585(3)
Appendix B
Bit manipulation
588(1)
Immutability
589(1)
Assertions
590(1)
Block scope
591(1)
Linked invocations
592(1)
Overriding equals()
593(1)
Access levels and access modifiers (who sees what)
594(2)
String and StringBuffer methods
596(1)
Multidimensional arrays
597(1)
Collections
598(9)
Index 607

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.