Java vs C++

Java vs C++

 Differences between C++ and Java are given below.

differences between C++ and Java
JAVA C++
Java is platform-independent. C++ is platform-dependent.
Java is mainly used for application programming. It is widely used in Windows-based, web-based, enterprise, and mobile applications.

C++ is mainly used for system programming. 

Java doesn't support multiple inheritance by class. It can be achieved by using interfaces in java.

C++ supports multiple inheritance.    

Java doesn't support the goto statement. C++ supports the goto statement.
Java doesn't support pointer. C++ supports pointers
Java doesn't support operator overloading. C++ supports operator overloading
Java supports call by value only. Java doesn't support call by reference in java. C++ supports both call by value and call by reference.    
Java uses both compiler and interpreter. Java source code is converted into bytecode at compilation time. The interpreter executes this bytecode at runtime and produces output. Java is interpreted that is why it is platform-independent. C++ uses compiler only. C++ is compiled and run using the compiler which converts source code into machine code so, C++ is platform dependent.    
Java has built-in thread support. C++ doesn't have built-in support for threads. It relies on third-party libraries for thread support.    
Java doesn't support structures and unions. C++ supports structures and unions.
Java has no virtual keyword. We can override all non-static methods by default. In other words, non-static methods are virtual by default.     C++ supports virtual keyword so that we can decide whether or not to override a function.    

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

23233