+ 2

What is the main difference between C++ and Java ?

Since both are object oriented programming languages. And both supports features like :- inheritance , polymorphism etc.. then what makes difference between java and c++..

19th Jan 2018, 5:36 PM
DEEPANKAR BABU
DEEPANKAR BABU - avatar
8 Answers
+ 3
It isn't meant to be an interpreted language. It is meant to be reasonably close in speed to compiled languages and quickly ported to new computers. Strictly interpreted languages are much slower in execution than compiled languages, but quick to port. Strictly compiled languages take a huge effort to port. Java is very nicely balanced to have the best of both worlds.
19th Jan 2018, 7:41 PM
John Wells
John Wells - avatar
+ 2
C++ is compiled, Java is interpreted. Besides that, pointers.
19th Jan 2018, 5:48 PM
Jacob Pembleton
Jacob Pembleton - avatar
+ 2
@jacob pembleton if it is interpreted then what is the use of JVM ? If it is an interpreter, then what about JIT compiler that exist inside the JVM?
19th Jan 2018, 5:59 PM
DEEPANKAR BABU
DEEPANKAR BABU - avatar
+ 2
It gets compiled into a bytecode then interpreted.
19th Jan 2018, 6:00 PM
Jacob Pembleton
Jacob Pembleton - avatar
+ 2
Thanks for answer.. @Mr. john wells
19th Jan 2018, 7:45 PM
DEEPANKAR BABU
DEEPANKAR BABU - avatar
+ 1
Java took a more principled approach with its library. It doesn't require header files. It is garbage collected. C++ later invented smart pointers. It hides/automates pointers. There is a fixed rule what goes where in memory. It has a top type for objects. It uses packages instead of friend keyword. Multiple inheritance is more limited in Java still. Type parameters are more expressive, but require auto boxing.
20th Jan 2018, 2:21 AM
1of3
1of3 - avatar
0
@jacob sir Then that shows that it is not perfectly interpreted based language..
19th Jan 2018, 6:01 PM
DEEPANKAR BABU
DEEPANKAR BABU - avatar
0
@Jacob Pembleton Java's byte code is compiled to native machine code when possible by the JVM's JIT
19th Jan 2018, 10:02 PM
aklex
aklex - avatar