Font Awesome Icons

Tutorial

c++ vs java

No. Topic C++ Java
1 Platform Independence C++ is platform dependent. Java is platform-independent.
2 Compiler & Interpreter C++ is a compiled language. Java is a compiled as well as an interpreted language.
3 Source Code & Class Relationship No strict relationship with class names and filenames. Enforces strict relationship between the class name and filename.
4 Concept Write once compile anywhere. Write once run anywhere & everywhere.
5 Compatibility With Other Languages Compatible with C except for object-oriented features. The syntax is taken from C/C++.
No backward compatibility with any other language.
6 Type of Programming Language Procedural and object-oriented. Object-oriented.
7 Library Interface Allows direct calls to native system libraries. Calls only through Java Native interface and Java Native Access.
8 Root Hierarchy No root hierarchy. Follows single root hierarchy.
9 Distinguishing Features Supports procedural as well as object-oriented features. No destructors. Automatic garbage collection.
10 Portability C++ code is not portable. Java is portable.
11 Type Semantics Consistent between primitive and object types. Not consistent.
12 Input Mechanism Cin and Cout are used for I/O. System.in and System.out.println
13 Access Control and Object Protection A flexible object model and consistent protection. The object model is cumbersome and encapsulation is weak.
14 Memory Management Manual System-controlled.
15 Multiple Inheritance Present Absent
16 Goto Statement Supports Goto statement. Does not support the goto statement.
17 Scope Resolution Operator Present Absent
18 Try/Catch Block Can exclude try/catch block. Cannot exclude if the code is supposed to throw an exception.
19 Overloading Supports operator and method overloading. Does not support operator overloading.
20 Virtual Keyword Supports virtual keyword which facilitates overriding. No virtual keyword, all non-static methods are by default virtual and can be overridden.
21 Runtime Error Detection Left to programmer. System responsibility
22 Language Support Used mainly for system programming. Mainly used for application programming.
23 Data and Functions Data and Function exist outside class. Global and namespace scopes are supported. Data and Functions are present only inside the class, package scope is available.
24 Pointers Supports pointers. Only limited support for pointers.
25 Structures & Unions Supported Not supported
26 Object Management Manual object management with new and delete. Automatic object management using garbage collection.
27 Parameter Passing Supports call by value and call by reference. Supports only call by value.
28 Thread Support Thread support is not very strong, it relies on the third party. Very strong thread support.
29 Hardware Nearer to the hardware. Not very interactive with hardware.
30 Documentation Comment Does not support documentation comment. Supports documentation comment(/**…*/) that creates documentation for Java source code.