Difference between Java and C language

Here are some of the differences between Java and C language.

C Java
C was developed by Dennis M. Ritchie between 1969 and 1973. Java was developed by James Gosling in 1995.
C is a Procedural Programming Language. Java is Object-Oriented language.
C is more procedure-oriented. Java is more data-oriented.
C is a middle-level language because binding of the gaps takes place between machine level language and high-level languages. Java is a high-level language because translation of code takes place into machine language using compiler or interpreter.
C is a compiled language that is it converts the code into machine language so that it could be understood by the machine or system. Java is an Interpreted language that is in Java, the code is first transformed into bytecode and that bytecode is then executed by the JVM (Java Virtual Machine).
C generally breaks down to functions. Java breaks down to Objects.
C programming language can be used for system programming as well as Application programming. This is not the case in Java.
C does not contain the property called Inheritance because it does not support OOPS, which is very useful for code reusability. Thus C is not suited when one has to relate the things according to the real world. Java contains the property of Inheritance which is very useful in code reuseability.
Memory allocation can be done by malloc in C Memory allocation can be done by a new keyword in Java.
C is a low-level language. It has difficult interpretation for the user but it has a closer significance to the machine-level code. Java is a high-level language because translation of code takes place into machine language using compiler or interpreter.
In C declaration of variables is at the beginning of the block. We can declare variables anywhere.
free is used for freeing the memory in C. A compiler will free up the memory internally by calling the garbage collector.

C does not supports Threading. Java supports the concept of threading.
C supports pointers. Java does not supports pointers.
It is not portable. It is portable.
Call by value and call by reference is supported in C. It only supports a call by value.
C is platform dependent. Java is a platform independent.
It supports user-based memory management. It internally manages the memory.
C is not robust that is strict type checking does not takes place while compile and run time. Java is robust.
Exception handling cannot be directly achieved in C and thus it lacks the maintenance of normal flow of the program. Exception Handling is supported in Java.
It follows a top-down approach. Java follows a bottom-up approach.
Overloading functionality is not supported by C. Java supports method overloading which helps in code readability.
C supports Preprocessors. Java does not support Preprocessors.
C does not supports OOPS concept. Java supports OOPS concept.
Overloading functionality is not supported by C. Java supports method overloading which helps in code readability.
C supports the storage classes. Whereas Java does not suport the storage classes.
It has 32 keywords. It has 50 keywords.
Go-to statements are supported in C language. Java does not supports go-to statements.
Virtual keywords are supported by C. Virtual keywords are not supported by Java.
Overloading functionality is not supported by C. Java supports method overloading which helps in code readability.
Default members of C are public. Default members of Java are private.
Data hiding is done by using static in C. Data hiding is done by using private in Java.


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.