Why Java instead of C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why Java instead of C++?

Why do we use Java to make mobile apps and games instead of C++? C++ has much better memory usage, isn't that good for a phone? What makes Java, the language to Android?

20th Dec 2016, 12:36 AM
Squik
Squik - avatar
2 Answers
+ 2
Java has a lot of features that are not in C++ such as automatic garbage collection (no need to use to free to delete allocated memory), no pointers(no memory issue, no dereferencing issues), multithreading(we can create thread that may also work in background) and platform independent (follows WORA- Write Once Run Anywhere)
20th Dec 2016, 2:27 AM
Ravi Kumar
Ravi Kumar - avatar
+ 1
This is from the Java Beginner's Guide book: Java has one other attribute in common with C and C++: it was designed, tested, and refined by real, working programmers. It is a language grounded in the needs and experiences of the people who devised it. There is no better way to produce a top-flight professional programming language. Because of the similarities between Java and C++, especially their support for object- oriented programming, it is tempting to think of Java as simply the “Internet version of C++.” However, to do so would be a mistake. Java has significant practical and philosophical differences. Although Java was influenced by C++, it is not an enhanced version of C++. For example, it is neither upwardly nor downwardly compatible with C++. Of course, the similarities with C++ are significant, and if you are a C++ programmer, you will feel right at home with Java. Another point: Java was not designed to replace C++. Java was designed to solve a certain set of problems. C++ was designed to solve a different set of problems. They will coexist for many years to come.
20th Dec 2016, 5:06 AM
Artemas
Artemas - avatar