https://en.wikipedia.org/wiki/Comparison_of_Java_and_C%2B%2B
the syntax is similar :
1 Objective :
C++ is created based on C for systems and applications programming.
Java is created for Network Computing, objective is portability (once developed, execute everywhere, as few implementation dependencies as possible) Depends on a JVM to execute.
2 Memory management
C ++ : if we do not use smart pointer, it's the programmer's responsibility to manage the memory : allocation(new) and dislocation(delete) memory.
Java: it's the JVM (Garbage Collection) dose the management for us : jvm will count the reference of the objects, and when there is no more reference, the memory is released.
3 Object-oriented
C++ is procedure-oriented and object-oriented. But C++ is compatible with C, so it's possible to see C-like codes in C++. (Multi inheritance; class/struct ; )
Java is object-oriented : Abstract, Encapsulation, Inheritance, Polymorphism. (interface)
Bref : in a word, C++ est plus difficult ( memory management, syntax like containers, iterators...) than Java, we pass more time in learning how to use the language but not in solving the problem.
No comments:
Post a Comment