Relationship Between C, C++ and Java

Relationship Diagram

Difference between C Language and Java

There are many differences and similarities between C programming language and Java. A list of top differences between C and Java are given below:

S.No C Language Java
C does not support object-oriented programs. It is a procedural programming language. Java is pure object–oriented programming language.
C uses structure, union and enum data types. Java does not support data types like structure, union and enum.
C uses type modifiers keywords auto, extern, register, signed and unsigned. Java does not define the type modifiers keywords auto, extern, register, signed and unsigned.
C uses preprocessors #define, #include and # ifdef. Java does not have a preprocessors like #define, #include and #ifdef.
C uses malloc function to allocate memory at run time.Java use new operator to allocate memory at run time.
C supports both call by value and call by reference.Java supports call by value only. There is no call by reference in Java.
C support global variables. We can declare variable outside a main function also. Java does not support global variables. Every variable and method is declared within a class.
In C, Pointers can be used. There is no concept of pointers in Java.
C supports goto statement. Java doesn't support goto statement.
In C we must include a header file before using a header file function. There is no concept of header files in Java. Only packages are used.

Difference between C++ and Java Language

There are many differences and similarities between C++ programming language and Java. A list of top differences between C++ and Java are given below:

S.No C++ Language Java
C++ is Platform dependent. Java is Platform Independent.
C++ uses compiler only.Java uses compiler and interpreter both.
C++ is basically a C language with object-oriented extension. Java is pure object – oriented language.
C++ uses operator overloading concept to overload operator. Java doesn't support operator overloading.
C++ uses template classes. Java does not have template classes.
C++ support multiple inheritance. Java doesn't support multiple inheritance through class. It can be achieved by interfaces in Java.
C++ uses destructor to destroy allocated memory. Java has replaced destructor with finalize() method.
C++ uses virtual function and virtual classes.In Java, there is no concept of virtual keyword.
Multi-threading programming cannot be possible in C++. Java supports multi-threading programming.
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.