Skip to content
Related Articles

Related Articles

Improve Article

Difference between Java and C language

  • Difficulty Level : Medium
  • Last Updated : 17 May, 2021

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

C is much faster than Java

Java is slower than C due to overhead.
 

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 reusability.
Memory allocation can be done by malloc in CMemory 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 C89 declaration of variables is at the beginning of the block but in the latest version of C that is C99 we can also declare variables anywhere.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.
Union and structure datatypes are supported by C.Java does not supports union and structures.
C supports the storage classes.Whereas Java does not support 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.

 

Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.
My Personal Notes arrow_drop_up
Recommended Articles
Page :