C vs. Java

svg viewer
svg viewer

C is a system programming language that was developed in 1972 by Dennis Ritchie.

Java was released in 1995 as a SunMicrosystems project.

Here’s a quick ​summary of how core functionality differs between these two languages:

Feature C Java
Programming Paradigms Procedural Procedural and Object Oriented
Approach Top to bottom Bottom to top
Memory allocation Uses malloc Uses new
Memory deallocation Uses free Automatically managed by the garbage collector
Threads It doesn’t support threads It supports threads
Calling Functionality Pass by value and pass by reference Pass by value
Portability It is platform dependent, thus, it is not portable It is platform independent

Here’s how data types compare

Data types C Java
String No Yes
Boolean Yes Yes
Classes No Yes

Lastly, Java also supports some other useful operations: functions in structures, function overloading, and inheritance. These don’t exist in C.

Code

Below is a basic example that ​prints Hello folks in both C and Java:

#include<stdio.h>
int main() {
printf("Hello Folks!\n");
return 0;
}

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved