Differences between C++ and Java
Following are the major differences between Java and C++ :
1)Use :-
→C++ is mainly used for system programming.
→Java is mainly used for application programming. It is widely used in window,
→Java is mainly used for application programming. It is widely used in window,
web-based, enterprise and mobile applications.
2) Compiler and Interpreter :-
→C++ uses compiler only.
→Java uses compiler and interpreter both.
3) Multiple inheritance :-
→C++ supports multiple inheritance.
→Java doesn't support multiple inheritance through class. It can be achieved by
interfaces in java.
interfaces in java.
4) Operator Overloading :-
→C++ supports operator overloading.
→Java doesn't support operator overloading.
5) Call by Value and Call by reference :-
→C++ supports both call by value and call by reference.
→Java supports call by value only. There is no call by reference in java.
6) Platform - independent :-
→C++ is platform-dependent.
7) Virtual Keyword :-
→C++ supports virtual keyword so that we can decide whether or not override a function.
→Java has no virtual keyword. We can override all non-static methods by default. In other words, non-static methods are virtual by default.
8) Structure and Union :-
→C++ supports structures and unions.
→Java doesn't support structures and unions.
9) Documentation comment :--
→C++ doesn't support documentation comment.
→Java supports documentation comment (/** ... */) to create documentation for java source code.
10) Goto :-
→C++ supports goto statement.
→Java doesn't support goto statement.