Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

migration rejected from Mar 23 '14 at 19:30

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as not constructive by Walter, Mark Trapp Jul 10 '11 at 17:37

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.


16 Answers 16

up vote 339 down vote accepted

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:

"I sure wish I had had this book ten years ago. Some might think that I don't need any Java books, but I need this one."
- James Gosling, Fellow and Vice President, Sun Microsystems, Inc.

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.

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". – binil Sep 16 '08 at 19:26
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 Sep 16 '08 at 21:32
"If every Java developer read this book ..." what you wanna say is "If every Java developer read and understood this book ..." – Chris Sep 25 '09 at 17:03
+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 May 18 '10 at 15:25
@binil I don't see how any Java book could ever become more important than Effective Java 2nd ed. except for maybe... Effective Java 3rd ed. – jluzwick Feb 16 '11 at 18:06

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 from 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. – Cole Jul 22 '10 at 0:24
If only the examples worked with a newer version of Java... – syrion Jan 2 '11 at 20:21
Examples are so long and some chapters (like JDBC, Hibernate) are missed. Can be useful for total newbies. After reading C# book by Andrew Troelsen I can say that this book is not great. But it seems that there are no other good books about introduction in Java 6 or 7. – Andrii Nemchenko Jan 31 '12 at 10:11

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". – Cowan Oct 1 '10 at 4:19

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? – Jonik May 12 '10 at 8:42
-1 on this one, sorry. Design patterns are better discovered than learned. – BlueRaja - Danny Pflughoeft May 18 '10 at 15:28
@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 ;-) – Yaba May 26 '10 at 21:03
I couldn't read this, pages and pages of hot air, I thinks it designed for young people (teenagers). – NimChimpsky Nov 10 '11 at 13:46

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.

by J Bloch and N Gafter – Michael Easter Oct 3 '08 at 21:01
Good book with some real mind benders but to me underlines the importance of unit testing. – ishmeister May 18 '10 at 15:59

Head First Java is great for beginners.

Effective Java will take you from journeyman to master.


Refactoring by Martin Fowler

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


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. – zilupe Jun 2 '09 at 12:52

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. – Jonik May 12 '10 at 8:51

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 Sep 3 '09 at 21:38
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 May 12 '10 at 8:24

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

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

Wow, THE specification didn't make it into the top 10 :-0 – DaveFar Sep 24 '11 at 20:18

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? – sivabudh Aug 6 '10 at 21:48

Better, Faster, Lighter Java by Bruce A. Tate and Justin Gehtland

It's 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 Sep 16 '08 at 18:59
+-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). – Jonik Apr 14 '09 at 16:13

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


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


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

alt text

+1 I agree that it is nice book, not the best I've read but is the first I read – c0mrade Oct 1 '10 at 7:57
I vouch for Data Structures in Java – Kim Jong Woo Nov 25 '10 at 18:39
+1 the nice thing about this book is that not only you learn java but also learn the very basic algorithms and data structures – chepukha May 25 '11 at 3:43