Pregunta de entrevista de AMD

Main difference between C++ and Java?

Respuesta de la entrevista

Anónimo

28 sep 2012

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