C++ Vs Java

 

Consider the following table that compares C++ and Java programming languages:

C++ Java
C++ programming language is platform dependent. Java programming language is platform independent.
C++ is used in system programming. Java is used for application programming.
C++ has goto statement to skip a number of lines. Java does not support goto statement.
Multiple inheritance is supported by C++. Multiple inheritance is not supported by Java through classes. But we can achieve it by interfaces in Java.
Operator overloading is supported in C++. Operator overloading is not supported in Java.
Pointers are supported by C++. Pointers are not supported by Java.
C++ programming language supports enum. Enum is not supported by Java programming language.
In C++ programming language we can use destructors. In Java programming language there is a concept of automatic garbage collection.
In C++ programming language we can use unsigned integer. In Java programming language unsigned integer is not supported.
C++ supports default arguments. Java does not support default arguments.
Class, structure and unions are supported by C++ programming language. Java only supports classes.
Preprocessors, typedefs are supported by the C++ programming language. java does not support typedefs, or preprocessors etc.
The C++ programming language does not need any run time environment. Java needs JVM to compile and interpret the code.
The C++ programming language is the extension of the C programming language. The Java programming language is based on C++ programming language.
In C++ programming language there is no built in threads. In Java programming language there are built in threads.
C++ programming language supports both method overloading and operator overloading. Java only supports method overloading.
In C++ programming language we can call the method of a class from anywhere using the scope resolution operator. In Java programming the definitions of the methods should be in class because it does not support scope resolution operator.
C++ is not object oriented programming language rather it supports object oriented programming. Java itself is an object oriented programming.
The C++ programming language uses only compiler Java uses both interpreter and compiler to run a program.
In C++ we can call a function by value and by reference also. In java we can only call a function y value.
The documentation comment is not supported in C++ programming language. Java supports the documentation comment to create documentation for the Java source code.
The virtual keyword is there in the C++ programming to decide if a function can be overridden or not. Java programming language does not support the virtual keyword.
The operator >>> is not supported in C++ programming language. The operator >>> is supported by the Java programming language.
C++ programming language does not support internet. Internet support is built in Java programming language.
Header files are used to include the library files in C++ programming language. The import keyword is used in Java to include classes, methods, etc.
The C++ programming language is more nearer to the computer hardware then Java. The Java programming language is not nearer to computer hardware as compared to C++.
The C++ programming language supports templates. Templates are not supported by Java programming language.