Think Java 2e

This is the home page for the second edition of Think Java, by Allen Downey and Chris Mayfield.

Buy Think Java from

Buy Think Java from Amazon

Download Think Java in PDF

Read Think Java online

Or read the interactive version hosted by Trinket.

The code examples in this book are available for download from this repository on GitHub.  Instructions for working with the code are in the preface of the book.


Think Java is a hands-on introduction to computer science and programming used by many universities and high schools around the world. Its conciseness, emphasis on vocabulary, and informal tone make it particularly appealing for readers with little or no experience. The book starts with the most basic programming concepts and gradually works its way to advanced object-oriented techniques.

In this fully updated and expanded edition, authors Allen Downey and Chris Mayfield introduce programming as a means for solving interesting problems. Each chapter presents material for one week of a college course and includes exercises to help you practice what you’ve learned. Along the way, you’ll see nearly every topic required for the AP Computer Science A exam and Java SE Programmer I certification.

  • Discover one concept at a time: tackle complex topics in a series of small steps with multiple examples

  • Understand how to formulate problems, think creatively about solutions, and develop, test, and debug programs

  • Learn about input and output, decisions and loops, classes and methods, strings and arrays, recursion and polymorphism

  • Determine which program development methods work best for you, and practice the important skill of debugging

Think Java is a free textbook available under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.  Readers are free to copy and distribute the text; they are also free to modify it, which allows them to adapt the book to different needs, and to help develop new material.  The LaTeX source for this book is in the ThinkJava2 repository on GitHub.


A free Dutch translation is available here