The Java programming language is one of the most used programming languages in the world and there are thousands of books out there to learn various topics.
Here are my top 3 books to learn java programming for beginners. Each of these books has its own style.
1- How to think like a computer scientist.
This book is actually the introduction course to computer programming at MIT. The book exists in two versions. One in python and the other in Java.
I usually recommend this book for computer science students.
2- Murach's java programming
If you want to learn how to get your first steps in the java programming with more practice than theory, this is the book you need.
All of Murach's publications follow the same pattern. The left page explains a specific point and the right page shows how to get this point done. So, if you open the book at any page you will find the theory at the left and the code at the right.
3- Introduction to java programming by Daniel Liang
I am considering this book a piece of art. It contains a massive amount of information. Its language is very simple for a non-native English speaker like me. The content of the book is well organized. The book also contains some intermediate and advanced topics.
The most thing I like about this book is its excersises. Each chapter has a set of excersises that start with simple tasks and its difficulty increase gradually.