What is a main difference between C++ and Java? | SoloLearn: Learn to code for FREE!


What is a main difference between C++ and Java?

Give a suggestion

5/19/2019 3:04:27 PM

Ashish Mewada

8 Answers

New Answer


Please do the two tutorials to find out.


The difference between c++ and Java c++ is a procedural and object oriented programming language c++ is not compulsory a class and the language is platform dependent and Java is pure object oriented programming language and in Java class is compulsory without class not compile code and java is a platform independent language. The java language is follow "wora" statement write once run anytime..


The main difference is that JAVA is 99% object oriented programming language and C++ is partially object oriented programming language In java 1% exception is handled by Wrapper class. In C++ we can make programme without class and can follow top to bottom approach of procedure oriented programming language One more important difference is that in C++ their is compiler but in JAVA their are both compiler and interpreter .


         ·         C++ is mainly used for system programming. Java is mainly used for application programming. It is widely used in window, web-based, enterprise and mobile applications. ·         C++ supports multiple inheritance. Java doesn't support multiple inheritance through class. It can be achieved by interfaces in java. ·         C++ supports pointers. You can write pointer program in C++. Java supports pointer internally. But you can't write the pointer program in java. It means java has restricted pointer support in java.


Correct answer


1 java is cross platform but c++ isnt 2 java is full object oriented but c++ less then it 3 java more usage then c++


Main differences are that 1. Java is provides platform independancy by JVM and byte code, while C++ is not ensure for platform independancy 2. Pointer is used in C++ that violet private data security, while Java not allowed pointer. But, allow reference variable. So, provides reference and also maintain security. 3. C++ allows multiple inheritance which cause problem while have same functions in two different class that is base class for derived class, While Java eliminates multiple interitance and allow it to only by interface. So, not ambiguity is created. I hope it will be helpful for know difference between C++ and Java.


Hi! There are a lot of difference, but the mainly is: - Syntax - Java is platform independent; - Java pass primitive value by copy.