TransWikia.com

How to learn Java as a beginner?

Computer Science Educators Asked by Long le Thanh on April 4, 2021

I want to start learning Java from scratch. But as a beginner, I don’t know where to start or what to learn first. I have basic knowledge in C++ but Java is an entirely new area to me. Can anyone give me some instructions and good books to start properly?

2 Answers

The first thing you need to understand is that your second language is, perhaps the hardest of all to learn. You already know "how to program" and so the second language seems to get in the way of that. Alternatively you just use the second language in the same way you used the first, resulting in ugly and sub-optimal programs. So, you want to guard agains that.

It is actually somewhat easier to learn a second language if it is nothing at all like the first, since you can't try to impose habits from one language on the other and have to absorb the actual philosophy of the new language. So, Scheme, for example, after C++ (or before) forces you to think in a new way.

So, learning Java after C++ is especially difficult, since the lowest level syntax of the two is nearly the same, but the underlying philosophy (paradigm) is quite different. In particular, Java and C++ both use what they call classes but they are really different creatures.

One book I'd recommend very highly (since I know and trust one of the authors) is by Barnes and Kölling. It does, however depend on also using the BlueJ IDE which they created and is available free online.

The reason I recommend it is that it introduces objects from the beginning, which is the fundamental difference between C++ and Java. So, if you put aside what you think you know about programming and believe in the authors, you should do well. They both have a very (very) deep understanding of what Object Orientation means.


An alternative that would work, if you somehow object to BlueJ is Cay Horstmann's Big Java Early Objects. It, too, starts with objects which is my primary recommendation. I also know Cay. He also has a Late Objects version that I don't recommend for a bunch of reasons, but one is that the first part of that book would be likely to bore you. While it might seem an easier path, it won't take you where you need to go as directly as the Early Objects version.


A third possibility, though it is intended more for first time programmers rather than for someone with experienced in another language, is Karel J Robot by Bergin, Stehlik, Roberts, and Pattis. This book focuses entirely on object oriented programming in Java but does not try to teach the entire language. It does, however, provide a system in which any program can be written. Like Pattis' original Karel the Robot it is an attempt to provide a minimal but complete system including a simulator in which interesting (and difficult) programs can be written.

Correct answer by Buffy on April 4, 2021

I'd like to reassure you that if you are accustomed to C++ Java won't be something really difficult to understand. Yeah, it's another language with its peculiarities but nothing enormously hard to cope with. Start from the basics - this rule always works the best. It's OK to be afraid of new things but they are interesting challenges at the same time. Regarding the books, I recommend you this one - Java: Programming Basics for Absolute Beginners by Nathan Clark (found it in the list with various best java books). It helps to structure the programming language and to get its concept even for a newbie.

Along with books, you may add some online java courses. It's a great starter pack and the point where to start from.

Answered by Lexxxis on April 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP