Difference between Java and C++

Categories: Core Java C++

Java is a platform independent language language. But c++ is not a platform independent language it depend on operating system machine.

Java does not support multiple inheritance but, c++ support multiple inheritance.

java does not support pointer, union, structure, templates, operator overloading but, c++ is support pointer, union, structure, templates, operator overloading and pointer arithmetic.

java uses compiler and interpreter both but, c++ is use compiler only.

At compilation time java program first java source code is compile then generate byte code means (.class ) and after interpreted convert the machine code before execution. But c++ run and compile uses compiler which convert source code into machine language.

Java has support method overloading but not support operator overloading. C++ support both method overloading and operator overloading.

Java has primitive data type like boolean which are not available in c++.

java has support documentation comment( /**............*/ ) , but c++ is not support documentation comment.

Java does not support scope resolution operator (: :), But c++ is support resolution operator.

Java does not support goto (but goto is reversed word).

C++ is more nearer to hardware then java.

Java does not support unsigned integer.

Java does not support global variable.

Thread support built in java but not c++.

Java does not support header file just like c++. it use import to add the class and interrface.

Exception and Auto Garbage Collector handling in Java is different because there are no destructors into Java.

ParametersJavaC++
FounderJava was developed by James Gosling at Sun Microsystems.C++ was developed by Bjarne Stroustrup at Bell Labs since 1979 as an extension of the C language.
First ReleaseOn May 23, 1995In October 1985
Stable ReleaseJava SE 14 or JDK 14 was released on March 17, 2020.C++17 was released in December 2017.
Official Websiteoracle.com/javaisocpp.org
Influenced By:Java was Influenced by Ada 83, Pascal, C++, C#, etc languages.C++ was Influenced by Influenced by Ada, ALGOL 68, C, ML, Simula, Smalltalk etc language.
Influenced to:Java was influenced to develop BeanShell, C#, Clojure, Groovy, Hack, J#, Kotlin, PHP, Python, Scala, etc languages.C++ was influenced to develop C99, Java, JS++, Lua, Perl, PHP, Python, Rust, Seed7, etc languages.
Platform DependencyPlatform independent, Java bytecode works on any operating system.Platform dependent should be compiled for different platforms.
PortabilityIt can run in any OS hence it is portable.C++ is platform-dependent hence it is not portable.
CompilationJava is both Compiled and Interpreted Language.C++ has only Compiled Language.
Memory ManagementMemory Management is System Controlled.Memory Management in C++ is Manual.
Virtual KeywordIt doesn’t have Virtual Keyword.It has Virtual Keyword.
Multiple InheritanceIt supports only single inheritance. Multiple inheritances are achieved partially using interfaces.It supports both single and multiple Inheritance.
OverloadingIt supports only method overloading and doesn’t allow operator overloading.It supports both methods and operators overloading.
PointersIt supports limited support for pointers.It strongly supports Pointer.
LibrariesIt doesn’t support direct native library calls but only Java Native Interfaces.It supports direct system library calls, making it suitable for system-level programming.
Librarieslibraries have a wide range of classes for various high-level servicesC++ libraries are comparatively low-level functionalities.
Documentation CommentIt supports documentation comment (e.g, /**.. */) for source code.It doesn’t support documentation comments for source code.
Thread SupportJava supports documentation comment (e.g, /**.. */) for source codeC++ doesn’t have built-in support for threads, depends on third-party threading libraries.
TypeJava is the only object-oriented programming language.C++ is both a procedural and object-oriented programming language.
Input-Output mechanismJava uses the (System class) System.in for input and System.out for output.C++ uses cin for input and cout for an Output operation.
goto KeywordJava doesn’t support goto KeywordC++ supports goto keyword.
Structures and UnionsJava doesn’t support Structures and Unions.C++ supports Structures and Unions.
Parameter PassingJava supports only the Pass by Value technique.C++ supports both Pass by Value and pass by reference.
Global ScopeIt supports no global scope.It supports both global scope and namespace scope.
Object ManagementAutomatic object management with garbage collection.It supports manual object management using new and deletes.

Top articles
Core Java Indroductions Published at:- Features of Java Published at:- Difference between Java and C Published at:- Difference between Java and C++ Published at:- Advantage and Disadvantage of Java Published at:- What is Java Published at:- Why Java is not Pure Object Oriented Language Published at:- Where and why Java is used Published at:- Java has Following Features Characteristics Published at:- Common Misconception about Java Published at:- 3 most commonly used tools are Published at:- Stream Creation-Jav 8.0(JDK1.8) Published at:- Data Type in Java-Size in Bytes & Bits . Published at:- Operators in Java-Assignment, increment and decrement, equality, arithmetic ,relational , logical, bit-wise, compound assignment Published at:- Java Control Flow of Statements Published at:- Java switch case and conditional operator Selection Statement Published at:- for and while Loop-Java Published at:- Java General Interview Questions and Answer Published at:- Write a program in Java to display the first 10 terms of the following series: 10, 20, 30, 40, …….. Published at:- Write the program in Java to display the first ten terms of the following series: 1, 4, 9, 16, Published at:- Write a program in Java to find the sum of the given series: Published at:- Write a program in Java to find the sum of the given series: Published at:- Why Proxies Are the Silent Backbone of Modern Online Operations Published at:-
R4Rin Team
The content on R4Rin.com website is created by expert teams.