Difference between C++ and Java

Profile picture for user arilio666

So in this article, we are gonna look at some of the differences between C++ and Java. Both have some similarities in the programming language they are in right now. We are gonna analyze the differences between these famous languages.

Comparison IndexC++Java
RelationshipThere is no restriction on different file names and class names as they don't have to be perfectly matched.Java follows this strict pattern of using the same filename as of class name.
Printing statements and inputHere we would be using the traditional in for input and cout for output in C++ eg:- in >> a ; count << b ;for input we use (System.in) and for output System.out.println("Hi")
Compiler And InterpreterOnly supports the compilerSupports both the compiler and the interpreter
CompatibilityIt is exceptional with C source code but only in extraordinary conditionsNo compatible language with the previous version, plus the syntax is already influenced by C and C++.
Run compatibilityWrite once and compile anywhereWrite once and can run anywhere and everywhere
InheritanceSupports multiple inheritances Supports multiple inheritances via through interface in java but not directly through the class.
Operator OverloadingIt supports operator overloadingDoes not support 
CommentsDoesn't support documentation comments Supports single line, multiline and documentation comment
HardwareIt is so nearer to hardware which is very interactive with it.Do not interact with it.
Object OrientedC++ is object oriented language.It is object-oriented, but however, everything in the java programming language is an object in java.