Is Java easy to learn after C++?

Hello. Does anyone know if Java (or, whatever the game 'Minecraft' is written
in) is easy to learn after C++?


I've only learned C++ so far when it comes to programming(Bad decision maybe,)
but apart from batch files, that's all I know.

So, is Java easier or harder to learn after C++???




Thanks.
In many ways, you can think of Java as simplified C++. It's not exactly the same - in Java everything is an object and managed by the Java runtime environment while in C++ you can access memory directly. If you're familiar with C++, you find much in Java that's familiar.

Some of the big differences are:

In C++ you can do things like overload operators and directly access memory. This makes things like doing vector math and image processing a lot easier. Java has workarounds, but they're kludgy.

In Java everything is an object and automatically garbage collected. This makes memory management much easier (although you do give up some control). C++ has something similar with smart pointers, but they're harder to use.

C++ make it easy to access your machine directly. There are lots more libraries for accessing peripherals and cards and blocks of memory. Java does have the JNI which lets you link to external C++ code, but you cannot do these things in pure Java.

Instead of templates, Java has generics which act sort of like templates. Generics basically just add type checking to collection classes like List and Map, while C++ templates rewrite your code in ways that can have surprising side effects.

Personally, I find Java easier and faster to develop in, although I also find that I also run into walls with a lack of supporting libraries (or the ability to write such) and wish that I had the ability to access memory more directly when doing data crunching. Java's memory model means that as a developer you have a lot less to think about and this makes coding faster and easier, although it also gives you much less control than you get in C++.

If you don't know Java, I'd certainly take a crack at it. It has enough similarities with C++ that you should pick it up quickly, especially if you have a decent IDE like Netbeans.
Last edited on
Thanks for the reply. Do you know anyone free online java guides?

Also, what is the difference between Javascript and Java???

I'd probably go with Oracle's https://docs.oracle.com/javase/tutorial/. Most of these were written back when Java was being developed at Sun. You can also go your local bookstore/library and see what they have there. O'Reiley is a good publisher and tends to have useful books.

Javascript is a completely different language, although it also borrows some ideas from C++. There are lots of differences, but I'd say the biggest ones are Java's modular design and strict typing make it suitable for large projects and Javascript's lack of such make it hard to use for anything larger than web pages. Java's also designed to run backends for servers while while Javascript is more client side.

However, all the languages are evolving and stealing the good ideas from each other and becoming increasingly difficult to distinguish from each other. I'm sure one day we'll all be programming in some hybrid C/Java/Python/Go/Fortran language. Except the Lisp programmers.
Last edited on
Oh, ok. Is the website free?

Also, can Javascript be used to make something such as an online calculator and such??
If so, how would you go about making it online?
Yes it is. You can also find lots of tutorials just by doing web searches yourself.

Both languages can be used to make online calculators. I'd recommend studying the language you wish to use, as this is a bit too much to describe in a forum post.
Ok, -oh, one more thing, does this website tell how to make a real website that others can
view???
Setting up your own website is something completely different. If you want to create your own website, you need to either rent space from a webserver company or set up your own computer to serve web pages.

I'd recommend reading about how to build basic websites before moving on to programming. If you're really just beginning to learn about all of this, don't do websearches but instead go to your local bookstore or library and pick up a book on creating websites. You're going to need to do a lot of reading to understand what's going on. I'd recommend books on HTML and maybe Apache webserver. O'Reilly is a good book publisher that's been around for a while (https://www.oreilly.com/), but browse through the other books too to find one that works for you.
Last edited on
Thanks. :D
the biggest problem I have with java after c++ is that there are a dozen little things that you simply cannot do and have to write odd workaround statements to get them done that make the code even slower (extra steps) and harder to follow (strangeness in the middle of code).

the most basic example of this is simply trying to write something that requires an unsigned integer. Java forgot to allow those, so the areas where it is needed require constant gibberish inserted to force normal integers to behave as if unsigned.

I find javascript to be much closer to C++ and the biggest oddity there was that it can do multi-threading without telling you about it, which is not always easy to 'fix' so you get what you want from it. Maybe this is more of a quirk of the node-js flavor, not 100% sure, but it was a struggle to adapt to that.

I hate when they name things incorrectly. C# is nothing like C nor C++; its the odd result of microsoft's modified java and losing that lawsuit. Javascript is nothing like java (well, they all share C like root syntax at some level) but they tacked the name onto it -- it is its own language and deserved a better name. But they are what they are at this point, confusing as it all is.
Last edited on
Topic archived. No new replies allowed.