Which Java book do you think is the must-have one for all Java developers?

Keep in mind:

  • One book per answer
  • Check for duplicates before adding new answers
+176  A: 

Effective Java, Second Edition by Joshua Bloch. No question.

If every Java developer read this book, there would be a lot less broken code in the world.

After that, I'd read Java Concurrency in Practice (see separate answer), and maybe Java Generics and Collections (see separate answer). Anyone that reads and puts into practice the information in these three books has come a long way toward mastering Java.

Comments from duplicate "Effective Java" answers:

sammyo: It's a thin(!!) volume that focuses on real issues and how to think about the right approach to java problems. (as opposed to a listing of API methods)

Hans Doggen: First edition of Effective Java and then the second edition, to see some of the ideas that changed over time.

Frank Pape
yes, thanks i think these books are great,
Choosing an "answer" for this question is unfair. Each person answering posts their own opinion and the community votes the more relevant answers up. If a book better than EJ2 is released, this page might turn out to be useless, because one opinion is already anointed as the "answer".
You make a fair point -- it's not necessarily appropriate to accept an answer for a subjective question -- although one of the nice things about SO is that this entry can always be edited if it becomes outdated.
Frank Pape
"If every Java developer read this book ..." what you wanna say is "If every Java developer read and understood this book ..."
James Gosling also mentioned that he needs this book.
Yan Cheng CHEOK
+1000 for Effective Java, I have been reading this every day during my lunch break, and it's hands-down one of the best programming books I've ever read.
BlueRaja - Danny Pflughoeft
+12  A: 

O'Reilly's Java in a Nutshell is a good book for both tutorials and reference.

This book only covers up to Java 5 so it might be a bit outdated as a reference.
Li Lo
I particularly liked the *Java Examples in a Nutshell* book from that series, not because it was full of idiomatic code (it wasn't; my version is massively outdated!) but because it is great at inspiring me to try to do new things with Java.
Donal Fellows
+3  A: 

Agile Java: Crafting Code with Test-Driven Development is what got me started on Test-Driven Development. It helped me a lot both learning TDD and Java at the same time.

+7  A: 

Filthy Rich Clients, by Chet Haase and Romain Guy. Those guys are Swing ninjas.

+43  A: 

Thinking in Java by Bruce Eckel

Comments from duplicate answers:

prash: Thinking in Java by Bruce Eckel is a great book for beginners and teaches you not only the "What"s and "How"s of Java but also the "Why"s. It is available as a free download at the above link.

Michael Easter: It is an introduction and yet discusses the background behind Generics, Swing, elementary threading, and a large metaphor for Java NIO. It is a massive work that covers the range from beginner to expert. There are other books that are better for experts but would be wasted on novices.

I got this book in 2001 and it depresses me that I didn't read it :( Bruce Eckel is a great author, it just didn't work for me as a total newbie to programming. I didn't really understand *why* to create a class or method what I could do with these concepts.
+2  A: 

Nobody has mentioned Dietel & Dietel's How to Program Java . I love these books, especially for their exercises.

Too thick... Compare with Effective Java!
Thorbjørn Ravn Andersen
A read for any ambitious beginner
+24  A: 

Head First Java is great for beginners.

Effective Java will take you from journeyman to master.

Bill the Lizard
+1  A: 

First edition of Effective Java and then the second edition, to see some of the ideas that changed over time.

Hans Doggen
-1 for duplicate.
Péter Török
+1  A: 

Java Threads by Scott Oaks. An excellent introduction to this difficult but important topic.

Dave Webb
+2  A: 

Practical Java by Haggar. Very similar to Effective Java.

+1  A: 

The Java Class Libraries by Chan Lee.

This started as a single volume, then was published as two, and who knows how it will evolve, however it is the Bible when writing Java. It's similar to but better than the online documentation.

Caution: You already have to know how to think in the object world - this isn't a beginners text, though it's an essential reference for beginners.

+9  A: 

Better, Faster, Lighter Java

By Bruce A. Tate, Justin Gehtland

Its a really good one.

It's good, but a little dated, I find. For example, the whole anti-EJB diatribe is a bit boring to read in 2008, since that debate was settled so long ago, now. To me, The Pragmatic Programmer's way of presenting principles and techniques is more timeless.
Mwanji Ezana
+-0 I agree with Mwanji. The promise of the book (from the back cover or Amazon summary) seemed great. But for me, it didn't really deliver: nothing that new; examples not especially well thought out; not written in a very engaging manner (when compared to the *best* Java books I've read).
+33  A: 

Java Puzzlers is another great one by Joshua Bloch (with Neal Gafter).


The entire content of the book is just small Java applications that are quirky enough that they don't necessarily behave how you might immediately think.

Kamikaze Mercenary
by J Bloch and N Gafter
Michael Easter
Good book with some real mind benders but to me underlines the importance of unit testing.
+6  A: 

Java Generics and Collections by Maurice Naftalin & Philip Wadler. Philip Wadler is one of Java generics grandfather. Java is close enough to C++ that it wasn't a big deal at all for me to switch over, that was until I started using Generics. This book is a gold mine of info.

How did you find Java Generics different from C++'s templates?
+2  A: 
+14  A: 

Core Java Vol 1 and Vol 2 by Cay S. Horstmann.

Hard to read but very informative and without excess words. These books cover every aspect in Java SE. But this book will be a little hard for beginners IMO.

+1 because these are *good* and deserve to get noticed, even if they aren't nearly the *best* Java books.
+3  A: 

Currently Reading through "Spring in Action" and so far it has a course set for one of my top java books.

+32  A: 

Head First Design Patterns - not necessarily a pure Java book, but essential for every Java developers who designs his applications himself.

*Essential*, eh? Even for those who've already learned about design patterns e.g. from the original GoF book?
-1 on this one, sorry. Design patterns are better [discovered than learned](http://stackoverflow.com/questions/2101875/what-are-some-programming-questions-or-mistakes-you-get-wrong-only-as-you-get-b/2776764#2776764).
BlueRaja - Danny Pflughoeft
@Jonik, yes - even those that learned patterns from the GoF book as this book teaches you how Design patterns are evolved and principles behind a pattern. It teaches you how to discover patterns instead of learning it.@BlueRaja... I agree and that's exactly the reason why I recommend this book. Too bad you haven't read it bevor voting down ;-)
+2  A: 

Everyone should read Effective Java once.
Thinking in Java is a good intro for transitioning programmers.

The best Java book I've read in the last 5 years was Java Concurrency in Practice by Brian Goetz

Bryan Young
I second your statement about *Java Concurrency in Practice*.
Once cannot do it for Effective Java. Many of the concepts takes time to settle in your mind.
Thorbjørn Ravn Andersen
-1 duplicate on 2 counts. Plus only one book per answer was asked.
Péter Török
+9  A: 

Java Language Specification (also freely available online) is great if you want to get deeper into the semantics of Java language.

alt text

(Links and comments above merged from a duplicate answer by folone.)

+23  A: 

Refactoring by Martin Fowler

Especially the chapter about Bad Smells in Code should be understood by everyone.

Roland Schneider
+2  A: 

Wicked Cool Java

+13  A: 

Java Programming Language is a good way to learn Java. I would highly recommend it.

This is the second best book after Effective Java (but one should read this at first). I don't understand why it got only one vote before my vote. This is the only book that could explain to me Java Generics. I wish I had discovered earlier.
+4  A: 

Learning Java has really helped me get up-to-speed.

And Hardcore Java is an incredible follow-on for intermediate Java developers.

I agree. One of the best computer books I've ever read
+2  A: 

Java Web Services Architecture published in 2003 by Morgan Kaufman


Also not really a Java only book, but one that would lead to less ugly Java code: Eric Evans -- "Domain-Driven Design". Read it and go tackle that complexity!

Johannes Stiehler
+1 I've heard smart people praise this one. And the part (about Modules) I've actually read so far was very clearly written.
+1  A: 

Beyond Java :)

Andrei Vajna II

In my undergrad days I referred to " Java: A Framework for Program Design and Data Structures", Second Edition, by Kenneth Lambert, Martin Osborne . I has a lot of analysis on solving many standard problems and also demonstrates the design and implementation of various model classes to solve them.


I think tha java tutorials from Sun's website...you learn from the designer-implementor of the language.:)


no ones said the elements of java style yet which i think is an awesome little book.

krystan honour
+1  A: 

Sam's Teach Yourself Java 6 in 21 Days is a great book. Great for someone completely new to programming

Why the down-vote? I'll bet someone got something good out of it. I think people slam these books "just because."
Whoever downvoted was not fair. The OP asked for what's "best Java book *you*'ve read so far." Alexganose gave his opinion, so why downvoted him? I voted +1 to even this out.
+20  A: 

When it comes to multithreading, Java Concurrency in Practice is the choice.

Brilliant brilliant book. I guess I'm considered _something_ of a concurrency expert at my employer, yet every time I look in this book I go "wow, I didn't realise it worked like that".
+4  A: 

If you want to understand, how it all works, The Java Virtual Machine Specification (also freely available online) is the book for you.


Effective Java, Second Edition

It's already at the top of the list and accepted. Come on now.
If it's be best it's the best.
Duplicate answers add nothing though. Just upvote the original.

Java Performance Tuning - Jack Shirazi is also a good one

+1  A: 

Concurrent Programming in Java: Design Principles and Patterns http://java.sun.com/docs/books/cp/

Miro A.
+1  A: 

Data Structures and Algorithms in Java by Robert Lafore. Nice book.

alt text

Samit G.
@Samit G +1 I agree that it is nice book, not the best I've read but is the first I read

Spring Recipes: A Problem-Solution Approach by Gary Mak. Great book and fast read.

Samit G.

Java Elements

good book,not very comprehensive though

+3  A: 

The Art and Science of Java is the best Java book I have ever read.

Also, thanks to the others users for giving such a wide range of books.

My personal favorites are: Art & Science of Java, Head First Java and Thinking in Java.

Humming Bird

It was said above that "Thinking in Java" by Bruce Eckel was available for free on his website. That is not entirely true: Editions 1-3 are available, but not the 4th edition, which is the only one that covers Java 5 and 6.

link text


what do u think about " Java , How to programming " ? is that best one ?

This is more of a question than an answer.