
This is a collection of 23 best free Java books that will help you learn the Java programming language from scratch. You can download them in various digital formats: PDF, ePub, Mobi, Kindle or read online.
Think Java, 2nd Edition

The second edition of Allen Downey and Chris Mayfield’s Think Java is intentionally concise. Each chapter is 12-14 pages and covers the material for one week of a college course. It is not meant to be a comprehensive presentation of Java, but rather, an initial exposure to programming constructs and techniques.
The draft second edition of this free textbook is available under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Think Java: How to Think Like a Computer Scientist

Allen B. Downey and Chris Mayfield’s Think Java: How to Think Like a Computer Scientist is an introduction to computer science and programming intended for readers with little or no experience. The book presents each new idea in a logical progression. The goal of this book is to teach you to think like a computer scientist.
This book is available under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Think Data Structures

Allen B. Downey’s Think Data Structures: Algorithms and Information Retrieval in Java is intended for college students in computer science and related fields, as well as professional software engineers, people training in software engineering, and people preparing for technical interviews. Before you start this book, you should know Java pretty well.
This book is available under a Creative Commons license.
Introduction to Programming Using Java

David J. Eck’s Introduction to Programming Using Java is an introductory computer programming textbook that uses Java as the language of instruction. It is suitable for use in an introductory programming course and for people who are trying to learn programming on their own. The Eighth Edition of the book uses Java 8, with brief coverage of features that were added to the language in Java 9 and later. JavaFX is used for GUI programming. All sample programs and exercise solutions have been compiled with Java 11 and with Java 12, as well as with Java 8.
The Java Tutorial

The Java Tutorials is based on the Java Platform, Standard Edition (Java SE) 8. It introduces the new features added to the platform, including lambda expressions, default methods, aggregate operations, and more. An accessible and practical guide for programmers of any level, this book focuses on how to use the rich environment provided by Java to build applications, applets, and components. The Java Tutorials have been written for JDK 8. Examples and practices described in this page don’t take advantage of improvements introduced in later releases and might use technology no longer available.
Java Succinctly Part 1

Christopher Rose’s Java Succinctly Part 1 provides an introduction to programming in Java. It covers the fundamental building blocks of the language and is designed for readers who have little or no programming background. The main objective of this e-book is to describe the foundations of Java—from printing a line of text to the console all the way up to inheritance hierarchies in object-oriented programming.
Java Succinctly Part 2

Christopher Rose’s Java Succinctly Part 2 will concentrate on more advanced features of Java, including multithreading, building GUI applications, and 2-D graphics/game programming. If you have not read the first book, Java Succinctly Part 1, and if you are not familiar with the basics of the Java language, it is strongly recommended you read that e-book first.
Java Notes for Professionals

GoalKicker.com’s The Java Notes for Professionals book is compiled from Stack Overflow Documentation. It’s content is written by the contributors at Stack Overflow.
Open Data Structures: An Introduction (in Java)

The goal of Pat Morin’s Open Data Structures: An Introduction (in Java) project is to free undergraduate computer science students from having to pay for an introductory data structures book. There are pseudocode and C++ editions too.
Introduction to Programming in Java

Robert Sedgewick and Kevin Wayne’s Introduction to Programming in Java: An Interdisciplinary Approach is an interdisciplinary approach to the traditional CS1 curriculum with Java. It teaches the classic elements of programming, using an “objects-in-the-middle” approach that emphasizes data abstraction.
An online version of this book is available on Author’s Website.
Java Programming for Kids

The goal Yakov Fain’s Java Programming for Kids is to help students learn to program in the most popular language in the world: Java. This book starts from an introduction to Java and then explains how to write programs that have Graphic User Interface by writing the Tic-Tac-Toe and Ping-Pong games.
Java Data Structures and Algorithms

BookBoon’s Java Data Structures and Algorithms is a standard introduction to data structures and algorithms using the Java programming language covering stacks, queues, lists, trees, sets, maps, graphs, hashing, searching, and sorting.
OOP – Learn Object Oriented Thinking and Programming

Rudolf Pecinovsky’s OOP – Learn Object Oriented Thinking and Programming is designed as a record of the dialogue of the author with his daughter who wants to learn programming. The author endeavors not to explain the Java programming language to the readers, but to teach them real programming. To teach them how to think and design the program as the experienced programmers do.
Data Structures and Algorithm Analysis in Java

Clifford A. Shaffer’s Data Structures and Algorithm Analysis in Java helps readers understand how to select or design the tools that will best solve specific problems. It uses Java as the programming language and is suitable for second-year data structure courses and computer science courses in algorithm analysis.
Killer Game Programming in Java

Andrew Davison’s Killer Game Programming in Java describes modern (i.e. fast, efficient) Java programming techniques for writing a very broad range of games, including 2D arcade-style, isometric (2.5D), 3D, and network games, with a strong emphasis on 3D programming using Java 3D.
The draft versions of the chapters of this book and additional chapters are available on author’s website.
Pro Java 6 3D Game Development

Andrew Davison’s Pro Java 6 3D Game Development will show you how to develop and program 3D games in Java technology on a PC, with an emphasis on the construction of 3D landscapes. It’s assumed you have a reasonable knowledge of Java—the sort of thing picked up in a first Java course at school.
The draft versions of the chapters of this book and additional chapters are available on author’s website.
Java Structures

Duane A. Bailey’s Java Structures: Data Structures in Java for the Principled Programmer offers a fresh, compact introduction to the design of traditional data structures in Java.
What’s New in Java 8

Adam L. Davis’s What’s New in Java 8: An unofficial guide to Java and JDK 1.8 will help you understand Java 8, including Project Lambda, the new Date-Time API, Streams, Nashorn, and more.
You can read the first six chapters of this book for free.
The Java Language Specification, Java SE 14 Edition

Written by the inventors of the technology, The Java Language Specification, is the definitive technical reference for the Java programming language. It provides complete, accurate, and detailed coverage of the Java programming language. It fully describes the new features added in Java.
The Java Virtual Machine Specification, Java SE 14 Edition

Written by the inventors of the technology, The Java Virtual Machine Specification, is the definitive technical reference for the Java Virtual Machine. It provides complete, accurate, and detailed coverage of the Java Virtual Machine.
Blue Pelican Java

Charles E. Cook’s Blue Pelican Java is a somewhat unusual high school computer science textbook. Most computer science texts will begin with a section on the history of computers followed with a flurry of definitions that are just “so many words” to the average student. The approach here is to first give the student some experience upon which to hang the definitions that come later.
Object-oriented Programming in Java

Richard L. Halterman’s Object-oriented Programming in Java is aimed at students with little or no programming experience, and it uses DrJava as a vehicle for student experimentation object-oriented programming concepts.
Introduction to Computer Science using Java

Bradley Kjell’s Introduction to Computer Science using Java is a first course in Computer Science using the programming language Java. It is intended for high school AP Computer Science classes, for university level CS-I classes, and for self study.
* The book cover images are the property of respective copyright owners.