Font Awesome Icons

Tutorial

c++ vs java

No.TopicC++Java
1Platform IndependenceC++ is platform dependent.Java is platform-independent.
2Compiler & InterpreterC++ is a compiled language.Java is a compiled as well as an interpreted language.
3Source Code & Class RelationshipNo strict relationship with class names and filenames.Enforces strict relationship between the class name and filename.
4ConceptWrite once compile anywhere.Write once run anywhere & everywhere.
5Compatibility With Other LanguagesCompatible with C except for object-oriented features.The syntax is taken from C/C++.
No backward compatibility with any other language.
6Type of Programming LanguageProcedural and object-oriented.Object-oriented.
7Library InterfaceAllows direct calls to native system libraries.Calls only through Java Native interface and Java Native Access.
8Root HierarchyNo root hierarchy.Follows single root hierarchy.
9Distinguishing FeaturesSupports procedural as well as object-oriented features.No destructors. Automatic garbage collection.
10PortabilityC++ code is not portable.Java is portable.
11Type SemanticsConsistent between primitive and object types.Not consistent.
12Input MechanismCin and Cout are used for I/O.System.in and System.out.println
13Access Control and Object ProtectionA flexible object model and consistent protection.The object model is cumbersome and encapsulation is weak.
14Memory ManagementManualSystem-controlled.
15Multiple InheritancePresentAbsent
16Goto StatementSupports Goto statement.Does not support the goto statement.
17Scope Resolution OperatorPresentAbsent
18Try/Catch BlockCan exclude try/catch block.Cannot exclude if the code is supposed to throw an exception.
19OverloadingSupports operator and method overloading.Does not support operator overloading.
20Virtual KeywordSupports virtual keyword which facilitates overriding.No virtual keyword, all non-static methods are by default virtual and can be overridden.
21Runtime Error DetectionLeft to programmer.System responsibility
22Language SupportUsed mainly for system programming.Mainly used for application programming.
23Data and FunctionsData and Function exist outside class. Global and namespace scopes are supported.Data and Functions are present only inside the class, package scope is available.
24PointersSupports pointers.Only limited support for pointers.
25Structures & UnionsSupportedNot supported
26Object ManagementManual object management with new and delete.Automatic object management using garbage collection.
27Parameter PassingSupports call by value and call by reference.Supports only call by value.
28Thread SupportThread support is not very strong, it relies on the third party.Very strong thread support.
29HardwareNearer to the hardware.Not very interactive with hardware.
30Documentation CommentDoes not support documentation comment.Supports documentation comment(/**…*/) that creates documentation for Java source code.
Hi, Welcome to etechvidya