4.C++ Vs Java
4.C++ Vs Java
SREEKANTH 1
JAVA
C++ vs Java
Comparison C++ Java
Index
Mainly used C++ is mainly used for Java is mainly used for application programming. It is
for system programming. widely used in window, web-based, enterprise and
mobile applications.
Design Goal C++ was designed for Java was designed and created as an interpreter for
systems and applications printing systems but later extended as a support
programming. It was an network computing. It was designed with a goal of being
extension of C easy to use and accessible to a broader audience.
programming language.
Multiple C++ supports multiple Java doesn't support multiple inheritance through class.
inheritance inheritance. It can be achieved by interfaces in java.
Pointers C++ supports pointers. You Java supports pointer internally. However, you can't
can write pointer program write the pointer program in java. It means java has
in C++. restricted pointer support in java.
SREEKANTH 2
JAVA
Compiler and C++ uses compiler only. Java uses compiler and interpreter both. Java source
Interpreter C++ is compiled and run code is converted into bytecode at compilation time. The
using the compiler which interpreter executes this bytecode at runtime and
converts source code into produces output. Java is interpreted that is why it is
machine code so, C++ is platform independent.
platform dependent.
Call by Value C++ supports both call by Java supports call by value only. There is no call by
and Call by value and call by reference. reference in java.
reference
Structure and C++ supports structures Java doesn't support structures and unions.
Union and unions.
Documentatio C++ doesn't support Java supports documentation comment (/** ... */) to
n comment documentation comment. create documentation for java source code.
Virtual C++ supports virtual Java has no virtual keyword. We can override all non-
Keyword keyword so that we can static methods by default. In other words, non-static
decide whether or not methods are virtual by default.
override a function.
unsigned right C++ doesn't support >>> Java supports unsigned right shift >>> operator that
shift >>> operator. fills zero at the top for the negative numbers. For
positive numbers, it works same like >> operator.
Inheritance C++ creates a new Java uses a single inheritance tree always because all
Tree inheritance tree always. classes are the child of Object class in java. The object
class is the root of the inheritance tree in java.
SREEKANTH 3
JAVA