Difference Between C++ and Java

C++JavaServer Side ProgrammingProgramming

JavaC++
Java was developed by James Gosling at Sun Microsystems.C++ was developed by Bjarne Stroustrup at Bell Labs, as an extension to C language.
It was influenced by Ada 83, Pascal, C++, C#.It was influenced by Ada, ALGOL 68, C, ML, Simula, Smalltalk.
The Java bytecode works on any operating System.It doesn’t work on every operating system since libraries are different on different systems.
It can run on any OS.It is compiled differently on different platforms, can’t be run on any OS.
It is portable.It isn’t portable.
It is an interpreted language.It is a compiled language.
Memory management is done automatically.Memory management is done manually.
It doesn’t have ‘virtual’ keyword.It has the ‘virtual’ keyword.
It supports single inheritance only. Multiple inheritance can be achieved using interfaces (partial only).It supports single and multiple Inheritance.
It doesn’t support operator overloading.It supports operator overloading.
It provides limited support to pointers.It supports pointer operations.
They have high level functionalities.They have low level functionalities.
It doesn’t support direct native library call.It supports direct system library calls.
It supports documentation comment (/**.. */) for source code.It doesn’t support documentation comment for source code.
It supports thread operations.It doesn’t support threads by design. It can be done by using third party threading libraries.
It uses the ‘System’ class, i.e System.in for input.It uses ‘cin’ for input operation.
It uses System.out for output.It uses ‘cout’ for an output operation.
It uses System.out for output.It uses ‘cout’ for an output operation.
It doesn’t support global scope.It supports global scope as well as namespace scope.
It doesn’t support structures and unions.It supports structures and unions.
It doesn’t have the ‘goto’ keywordIt supports the ‘goto’ keyword.
It supports Pass by Value method only.It supports Pass by Value and pass by reference methods.
It performs object management automatically using garbage collector.It performs object management manually with the help of ‘new’ and ‘delete’.
raja
Published on 23-Mar-2021 08:19:36
Advertisements