Sunday, October 27, 2019

What is the best Book to Learn Java for C and C++ Programmer?

In the last 2 decades, many Java programmers started programming with C and C++, but the situation is changed now, you have more choices like you can choose Python, or you can even start with Java. It seems Academia prefers Python in the USA and Java in India, but there are still many programmers who know C and C++ and want to learn Java for one or other reasons. I often receive emails from my readers about book recommendation, and recently, a couple of them asked me to suggest the best Java books for C and C++ programmers. I can relate those beginners to myself because I have also gone through the same phase, but those days, the university textbooks are our only source to learn new things. We didn't have broadband, and unlimited access to the Internet and eBooks was not popular at that time, but things have changed.

The good thing is now I know a couple of excellent books that can help to utilize most of his C and C++ knowledge to learn Java, like Core Java Volume 1 - Fundamentals by Cay S. Horstmann which provides a comparative analysis with C++ time to time.

For example, if you have worked in C++ for a couple of years, then you are already familiar with the Template feature. You will find that it's quite similar to Generic in Java, but not exactly the same. If you have read Core Java by Cay S. Horstmann, you will learn Generics by utilizing your previous experience on the C++ Template feature because this book will tell you which feature of Generics is similar to templates in C++ and where they are different.

This is just one example; there are many features in Java which has the origin in C++ but implemented slightly differently like multiple inheritance is available in both C++ and Java, but it's not exactly the same. Java's support of multiple inheritances is more granular than C++; you have multiple inheritances of type, and in Java 8, some level of behavior but not precisely the same as C++.

Another example is the concept of pass by value and pass by reference in Java, which is slightly different from C++. In C++ term everything in Java is pass by value because you have no pointer so you cannot pass the address of a variable like you do use & operator in C++, but when you pass objects to a method, a copy of the reference (handler to the object) is passed around. Which any modification on the same reference will be visible outside the method as well, much like it does in case you do pass by reference in C++.

There are plenty of such examples when it comes to learning Java after learning C and C++, and that's where I think a book like Core Java by Cay S. Horstmann helps a lot. 





Other good books to Learn Java for an experienced C++ programmer

As an experienced C++ developer, I expect you to know about the OOP concept, design patterns, SOLID design principles, multi-threading, and how to write code to implement any algorithm, how to use different data structures, and using various collection classes from BOOST and C++ STL library. When you start learning Java, you will find all these features are available and more or less in some form, like Java's collection framework contains many Collection classes from the BOOST library.

You will also find that OOP concepts and Design Patterns are exactly the same, Polymorphism is not very different, you can both overload and override methods. All you would like to learn is what distinct feature in Java does, how different they are from C++, and how to do things in the right way in Java.

So basically a refresher course of these essential concepts in Java language will help you a lot, and that's why I suggest the following books for experienced C++ developer learning Java for work :


1. Head First Design Patterns By Kathy Sierra

A refresher course in OOP design patterns where implementation and examples are in Java. This will quickly help you to start writing an intermediate level of code in Java using your existing knowledge of these things in C++.






2. Java: A beginners guide by Herbert Schildt

The best part of this book is that it is updated with the latest Java version, which is Java 8. If you are new to Java world, I suggest you start using Java 8 right from the beginning because it's designed for the modern system and allows you to better leverage the capability of multicore CPU and modern hardware.



Once you know Java and start feeling comfortable with the syntax, API, and their usage. You can start reading books mostly recommended to intermediate Java programmers, like Effective Java, Java Concurrency in Practice, Java Generics and Collections, and books about Java NIO. Combined with your experience in C++ and knowledge of application development, you will learn a lot more in a quick time.


That's all about some of the good Java books for C and C++ programmers who want to learn Java programming. As a C, C++ Developer your Java journey is likely to be smooth and some of you might appreciate the lack of pointers as it makes your code much more readable than what it was in C++. Still, many experienced C++ Dev might complain because of a lack of power due to no pointers.

In short, If you are coming from C and C++ background to Java and want to learn Java language and API in quick time and with a decent level of detail then you would probably benefit more from a book like Core Java Volume 1 - Fundamentals by Cay S. Horstmann and Core Java Volume 2 - Advanced Features, who provides comparative analysis with C++ time to time.

Best Book to Learn Java for C, C++ Programmer?

Further Learning
The Complete Java Masterclass
Java Fundamentals: The Java Language
Java In-Depth: Become a Complete Java Engineer!


If you love books, you may like to explore these articles as well:
  • 5 Books to Learn Data Structure and Algorithms in Java (list)
  • 7 Best Courses to learn Data Structure and Algorithms (online courses)
  • 6 Books to Master Coding in Java (list)
  • 20 websites to learn Coding for FREE (websites)
  • 5 Books to learn Python in depth (books)
  • 10 Best Courses to learn Python for Beginners (best python courses)
  • 5 Books to Learn Java Performance tuning and Garbage collection (list)
  • 7 Best Courses to learn Java Performance (online courses)
  • 2 Excellent books to prepare for Oracle Java Certifications (list)
  • 5 Books for preparing Programming/Coding Interviews (list)
  • 10 Courses to prepare for Coding interviews (courses)
  • 10 Books Every Programmer Should Read (list)
  • 3 Books to Learn and Master Eclipse IDE for Java developers (list)
  • 10 Free Books and Courses to learn Data Structure (books)
  • Top 5 Books to learn Python for Data Science (books)
  • 5 Books to learn Spring Boot and Spring Cloud for Java Programmers (books)
  • 3 Books to learn Hibernate for Java Developers (books)

Thanks for reading this article so far. If you like these books, then please share it with your friends and colleagues. If you have any questions or feedback, then please drop a note.  All the best with your Java journey, you can let me know if you come across any hurdle in your Java learning, and we can solve it together.

P. S. - If you like online courses and interactive learning along with reading books, then you can also check out this list of top 10 Java Courses on Medium to get the best of both worlds and learn Java quickly and better.

No comments :

Post a Comment