Shop now Shop now Shop now Shop All Amazon Fashion Up to 70% off Fashion Cloud Drive Photos Shop now Shop Amazon Fire TV Shop now Shop Fire HD 6 Shop Kindle Voyage Shop now Shop now Shop now
Head First Java and over 2 million other books are available for Amazon Kindle . Learn more
  • RRP: £29.99
  • You Save: £11.15 (37%)
FREE Delivery in the UK.
In stock.
Dispatched from and sold by Amazon.
Gift-wrap available.
Head First Java has been added to your Basket
+ £2.80 UK delivery
Used: Very Good | Details
Sold by thriftbooks-USA
Condition: Used: Very Good
Comment: All items ship from the USA.  Arrival time is usually 2-3 weeks. Book has appearance of light use with no easily noticeable wear. Spend Less. Read More. Your satisfaction is guaranteed.
Trade in your item
Get a £6.37
Gift Card.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

Head First Java Paperback – 19 Feb 2005

89 customer reviews

See all formats and editions Hide other formats and editions
Amazon Price New from Used from
Kindle Edition
"Please retry"
"Please retry"
£16.31 £11.13
£18.84 FREE Delivery in the UK. In stock. Dispatched from and sold by Amazon. Gift-wrap available.

Special Offers and Product Promotions

  • Save £20 on with the aqua Classic card. Get an initial credit line of £250-£1,200 and build your credit rating. Representative 32.9% APR (variable). Subject to term and conditions. Learn more.

Frequently Bought Together

  • Head First Java
  • +
  • Head First Design Patterns
  • +
  • Effective Java: Second Edition
Total price: £70.37
Buy the selected items together

Product details

  • Paperback: 720 pages
  • Publisher: O'Reilly Media; 2 edition (19 Feb. 2005)
  • Language: English
  • ISBN-10: 0596009208
  • ISBN-13: 978-0596009205
  • Product Dimensions: 20.3 x 3.8 x 23.5 cm
  • Average Customer Review: 4.1 out of 5 stars  See all reviews (89 customer reviews)
  • Amazon Bestsellers Rank: 12,883 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Authors

Discover books, learn about writers, and more.

Product Description

About the Author

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, 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.

Excerpt. © Reprinted by permission. All rights reserved.

Chapter 2 A Trip to Objectville

I was told there would be objects. In chapter 1, we put all of our code in the main() method. That’s not exactly object-oriented. In fact, that’s not object-oriented at all. Well, we did use a few objects, like the String arrays for the Phrase-O-Matic, but we didn’t actually develop any of our own object types. So now we’ve got to leave that procedural world behind, get the heck out of main (), and start making some objects of our own. We’ll look at what makes object-oriented (OO) development in Java so much fun. We’ll look at the difference between a class and an object. We’ll look at how objects can give you a better life (at least the programming part of your life. Not much we can do about your fashion sense). Warning: once you get to Objectville, you might never go back. Send us a postcard.

Chair Wars
(or How Objects Can Change Your Life)

Once upon a time in a software shop, two programmers were given the same spec and told to "build it". The Really Annoying Project Manager forced the two coders to compete, by promising that whoever delivers first gets one of those cool Aeron™ chairs all the Silicon Valley guys have. Larry, the procedural programmer, and Brad, the OO guy, both knew this would be a piece of cake.

Larry, sitting in his cube, thought to himself, "What are the things this program has to do? What procedures do we need? And he answered himself, "rotate and playSound." So off he went to build the procedures. After all, what is a program if not a pile of procedures?

Brad, meanwhile, kicked back at the café and thought to himself, "What are the things in this program... who are the key players?" He first thought of The Shapes. Of course, there were other objects he thought of like the User, the Sound, and the Clicking event. But he already had a library of code for those pieces, so he focused on building Shapes. Read on to see how Brad and Larry built their programs, and for the answer to your burning question, "So, who got the Aeron?

In Larry’s cube
As he had done a gazillion times before, Larry set about writing his Important Procedures. He wrote rotate and playSound in no time.

rotate(shapeNum) {
// make the shape rotate 360º
playSound(shapeNum) {
// use shapeNum to lookup which
// AIF sound to play, and play it

At Brad’s laptop at the cafe
Brad wrote a class for each of the three shapes

Larry thought he’d nailed it. He could almost feel the rolled steel of the Aeron beneath his...

But wait! There’s been a spec change.
"OK, technically you were fi rst, Larry," said the Manager, "but we have to add just one tiny thing to the program. It’ll be no problem for crack programmers like you two."

"If I had a dime for every time I’ve heard that one", thought Larry, knowing that specchange-no-problem was a fantasy. "And yet Brad looks strangely serene. What’s up with that?" Still, Larry held tight to his core belief that the OO way, while cute, was just slow. And that if you wanted to change his mind, you’d have to pry it from his cold, dead, carpal-tunnelled hands

Back in Larry’s cube
The rotate procedure would still work; the code used a lookup table to match a shapeNum to an actual shape graphic. But playSound would have to change. And what the heck is a .hif fi le?

playSound(shapeNum) {
// if the shape is not an amoeba,
// use shapeNum to lookup which
// AIF sound to play, and play it
// else
// play amoeba .hif sound

It turned out not to be such a big deal, but it still made him queasy to touch previously-tested code. Of all people, he should know that no matter what the project manager says, the spec always changes.

At Brad’s laptop at the beach
Brad smiled, sipped his margarita, and wrote one new class. Sometimes the thing he loved most about OO was that he didn’t have to touch code he’d already tested and delivered. "Flexibility, extensibility,..." he mused, reflecting on the benefits of OO

Larry snuck in just moments ahead of Brad.
(Hah! So much for that foofy OO nonsense). But the smirk on Larry’s face melted when the Really Annoying Project Manager said (with that tone of disappointment), "Oh, no, that’s not how the amoeba is supposed to rotate..."

Turns out, both programmers had written their rotate code like this:
1) determine the rectangle that surrounds the shape
2) calculate the center of that rectangle, and rotate the shape around that point.

But the amoeba shape was supposed to rotate around a point on one end, like a clock hand.

"I’m toast." thought Larry, visualizing charred Wonderbread™. "Although, hmmmm. I could just add another if/else to the rotate procedure, and then just hard-code the rotation point code for the amoeba. That probably won’t break anything." But the little voice at the back of his head said, "Big Mistake. Do you honestly think the spec won’t change again?"

Inside This Book

(Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

4.1 out of 5 stars

Most Helpful Customer Reviews

74 of 77 people found the following review helpful By M. Smith on 14 Jun. 2006
Format: Paperback
To give you a bit of context so you know where I was coming from before I started reading this book, I used to be a programmer many years ago (over 15), but haven't cut any code for years other than the odd bit of VBA in Excel. I've used mainly BASIC-style languages including Informix, VB, etc. I have read about OO and tried and failed to learn C so have no real experience or understanding of what Java can do. I wanted to learn Java now a) for something to do with my brain (how I miss programming!) and b) to see what all the fuss was about.

I found the book to be very accessible - it has lots of different ways of providing the information - straight text, pictures with text on, jokes (cheesy, but ok), break-out boxes, quizzes, etc. It is probably written for people with short attention spans, but that works ok for me. Sometimes it labours a point a bit too much, but it does mean that everything sticks and I have found this book to be an excellent way for me to learn Java so far. I'm learning new stuff and it is sticking - I can leave it for a few days and still remember everything (both how AND why things are done - something the book is very good at covering). After about a week of reading (doing about an hour a night after work) I have been able to write a basic command line calculator, which uses only about 100 lines of code. I have completed this in far less time than it would have taken me to do it in Informix/VB, etc.
Read more ›
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
35 of 37 people found the following review helpful By Mr. Simon Parkinson on 2 Jan. 2006
Format: Paperback
I'm learning Java, moving from 8 years C++ experience. Thus much of this book covers already familiar concepts such as OO and some of the basic syntax. however rather than finding these bits dragging and skipping over them I find myself rocketing through it, hunting for the new nuggests and differences in there and enjoying the learning experience!
The style is so distinctive and effectively alternates presentation and sub-set of the chapter's subject matter on a page by page basis. Thus as the book moves into newer territory its style prevents boredom and the "frequent coffee break syndrome". I find that the non linear and slightly "hopscotch" method of changing presentation styles, fore-shadowing areas to come and going over old ground in different ways is excellent.
Overall the progress through the book is good, though i find each chapter's progress varable. The chapters are effectively the smallest area of work - you really need to complete the chapter at the end of the day (for me anyway); however leaving the exercises till the next day is good revision!
Not sure whether it's java, this book, or both but I have more of a grin programming during learning from this book than ever before! Obviously it brings out the hidden geek in me!
I would say that anyone with some programming experience would find this book excellent. those with very little or none would probably find it hard - however still the best I've seen! What this book is NOT is a reference text - it's aim, basically, is a tutorial and thus precludes it's use as reference.
Have fun!
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
4 of 4 people found the following review helpful By Amazon Customer on 12 Jan. 2011
Format: Paperback
This is the first technical book I've ever bought and I was a bit unsure if I'd be able to teach myself Java without the aid of a lecturer, but as soon as I read the first few pages I was sure I'd be able to.

First of all, it's encouraging to see that new ways of teaching have emerged. The writers (and the whole team of course) know how to keep you interested using the latest studies in metacognition (thinking about thinking). It's what makes this book interesting. It's not dry. It's not boring. It's just like reading an interesting story with lots of stupid/nerdy jokes, but with the implementation of Java code always in mind.

As a reader, I came from a C++ background (beginner though) and I have to say that I could finally grasp concepts that I never really understood while studying C++. References, Stacks, Heaps: everything comes beautifully together with the writers' memorable graphs, stupid jokes etc. By reading this book, not only did I learn the Java language, but I also feel that I've learned much as a programmer in general (because every language has references, stacks, heaps etc).

A highly recommended book for anyone who wants to learn Java.

Hint: if you buy this book, you can register it at Oreilly's website and buy the book for the insignificant fee of $6. Quite useful if you have a tablet or an eBook reader etc.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
46 of 51 people found the following review helpful By Neil on 31 May 2010
Format: Paperback
I had been learning Java for about a week before buying this book. The first book I tried was Java For Dummies but it contained no exercises and seemed to tell you about Java rather then attempt to teach you it so I decided I needed another book. I thought as this was getting so many great reviews I would try this one.

First in the introduction of this book I was very disappointed to read that that they recommend backing away from this book if you have no programming experience what so ever. Well a bit late to be telling me now! Now I already own a copy!

I felt a little bit cheated because in the description of this book that I read before buying it says this..

"... for people with no Java experience, and even people with no programming experience at all."

I read through the customer reviews and it seems like half the reviews were saying "Not for beginners " and the others are saying "Just for beginners and not for experienced programmers."

Well this review is another one saying NOT for beginners.

If you ARE a beginner you will still learn a lot from this book. But it might make things more difficult and frustrating then they need to be.

For example the section on loops is VERY brief before it asks you to program the song "99 Bottles of Beer" using loops. Let me tell you that without any programming experience there is no way you could do this just by using the tiny bits of information the book has given you so far. It hadn't even told you that if you put the name of a variable into a print statement that it will print out the value of that variable. And their program covered several other new features that should have been introduced so you had a fair chance of figuring it out yourself.
Read more ›
2 Comments Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Most Recent Customer Reviews