C++ vs JAVA

https://www.educba.com/c-plus-plus-vs-java/

在这里插入图片描述
C++ uses the only compiler whereas, in Java, compiler and interpreter both are used.
C++ supports operator overloading and multiple inheritances but Java does not.
C++ is more related to hardware in contrast to Java.
C++ does not provide built-in support for internet whereas Java has built-in support for the same. However, C++ supports socket programming that can be used to achieve the same.
C++ uses the concept of header files to include different libraries in the program. Java uses import functionality to include different classes and its methods in the program.
C++ provides support for default arguments whereas Java does not.
C++ has the concept of scope resolution operator( :: ) which is used to define a method external to the class, whereas Java uses single dot( . ) which can be used to qualify classes with the namespace they came from.
Java does not use a go-to statement like C++.
Java does not have destructors, therefore, exception handling mechanism and garbage collection are different from C++.
Java supports method overloading whereas C++ supports method overloading as well as operator overloading.
Java has the concept of pass-by-value.
Java does not have the implementation of unsigned integers whereas C++ has.
C++ uses pointers and has the capability of manipulating memory addresses.
Java does not use pointers that make it a type-safe programming language.
Java uses Generics whereas C++ uses templates.
The JVM helps in an efficient code optimization so the performance of execution of the program is better than as that of C++.
C++ uses destructors which are automatically invoked at the time of object destruction.
Java has an in-built Thread class that needs to be inherited for the creation of a new thread. A programmer has to override its run() method.
C++ has no support for Threads like Java, C++ achieve the functionality of thread using external libraries.

发布了83 篇原创文章 · 获赞 0 · 访问量 851

猜你喜欢

转载自blog.csdn.net/michaelforgood/article/details/103577510
今日推荐