In this article, we are going to discuss the difference between C++ and Java.
You can also refer our video tutorial for same.
So let’s start with this tutorial :
Difference between C++ and Java :
There are many differences between C++ and Java. Some of the differences are given below :
SR. No. | Attribute | C++ | Java |
1. | Programming Paradigm | C++ is a multi-programming paradigm as it supports procedural programming and object-oriented programming paradigm. | Java supports object oriented programming paradigm. |
2. | Principle | C++ works on WOCA (write once compile anywhere). | Java works on WORA (write once run anywhere). |
3. | Platform Dependency | C++ is a platform dependent language. | Java is a platform Independent language. |
4. | Translation Issue | C++ is directly compiled into machine code, so we can say that c++ is a compiled language. | Java uses compiler and interpreter. Java source code is compiled into byte code at compilation time. The interpreter executes the byte code at runtime and produces output. |
5. | Portability | C++ is not a portabel language. | Java is a portable language. We can carry java byte code on any platform. |
6. | Secure | C++ is not so much secure programming language as C++ program directly contact with OS. | Java is a secured programming language as java program run inside the JVM. |
7. | Pointers | C++ supports pointer. we can pointer program in C++. | Java supports pointer internally but We cannot write pointer program in java. |
8. | Structure and Union | C++ supports structure and union. | Java does not support structure and union. |
9. | Multi-Threading | C++ does not have built-in support for thread. | Java has built-in thread support. |
10. | Function-calling | C++ supports both call b y value and call by reference. | Java supports call by value only. |
11. | Memory Management | C++ manages the memory via constructors and destructors. | Java does not support destructor, in place of destructor java use automatic garbage collection. |
12. | Extension | C++ files are saved by the extension “.cpp”. | Java files are saved by the extension “.java”. |
13. | Multiple-Inheritance | C++ supports Multiple-Inheritance. | Java does not support Multiple-Inheritance. |
If you found this post useful, don’t forget to share this with your friends, and if you have any query feel free to comment it in the comment section.
Thank you 🙂 Keep Learning !