0
Difference between java and c++??
3 odpowiedzi
+ 2
After a google search: The most important difference is that Java is a memory-safe language, whereas C++ is not. This means that errors in Java programs are detected in defined ways—for example, attempting a bad cast or indexing an array out of bounds results in an exception. Similar errors in C++ lead to undefined behavior, where instead of raising an exception or crashing, your program might keep running and crash later or even give the wrong answer or behavior. Overall, the presence of unsafe features in C++ such as unchecked casts, pointer arithmetic, and manual memory management (delete) means that C++ programming is much more error-prone that Java programming.
+ 2
According to Felipe and Zilvinas: Yes, Java gives us a garbage collector and is platform independent 😎
AND pointers imo are more comfy to use.
+ 1
I would say the biggest difference is how programs are executed. Java is platform-independent and runs on virtual machine, in contrast with C++ which is compiled to a specific system machine code.