AMD Interview Question: Main difference between C++ a... | Glassdoor

Interview Question

Co-Op Engineer Interview Sunnyvale, CA

Main difference between C++ and Java?

java, c++

Interview Answer

1 Answer


1/ I would say that the most important difference is portability. A Java program only needs to be written once but can run on any OS that runs the Java virtual machine. A C++ program on the other hand is tied to the OS it was written for (in most cases it is windows).
2/ The second big difference is the memory management process. In Java it is done automatically by a process called the garbage collector (gc) whereas in C++ it has to be hardcoded by the developer and as a result is prone to errors (though it gives more control to the developer).
3/ Java is slightly slower than C++ as a result of running on a virtual machine (it is said to be an interpreted language).
4/ Java is single inheritance (but can implement multiple interfaces) whereas C++ is multiple inheritance.
5/ Java is cool, C++ sucks

jule64 on Sep 28, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.