Difference Between C, C++, and Java
The programming languages C, C++, and Java are the most popular and widely used programming
languages in the market. In this section, we will discuss the differences between C, C++,
and Java. Apart from the similarities in syntax and that both are object-oriented, their design aim
and philosophy are different.
C is a general-purpose, structured, procedural, and high-level programming language developed
by Dennis MacAlistair Ritchie in 1972 at Bell Laboratories. The successor of the C language was CPL
(Combined Programming Language). It is mainly used for system programming such as to develop
the operating system, drivers, compilers, etc.
The best-known example of the operating system that was developed using C language is Unix and
Linux.
Features of C Language
o Machine independent and portable
o Modern Control Flow and Structure
o Rich set of operators
o Simple, Fast, and efficient
o Case-sensitive
o Low memory use
o Easily extendable
o Statically-typed
C++
C++ is an object-oriented, general-purpose, programming language developed by Bjarne
Stroustrup at Bell Labs in 1979. It is based on C language or we can say that it is an extension of C
language. It is used to develop high-performance applications.
Features of C++ Language
o Case-sensitive
o Compiler based
o Platform-independent
o Portability
o Dynamic memory allocation
Java
Java is also an object-oriented, class-based, static, strong, robust, safe, and high-level programming
language. It was developed by James Gosling in 1995. It is bot compiled and interpreted. It is used to
develop enterprise, mobile, and web-based applications.
Features of Java
o Object-oriented
o Architecture-neutral
o Platform independent
o Dynamic and Distributed
o Robust
o Secure
o Multithreaded
The following figure demonstrates that C++ is based on the C language and Java is based on the C++
and C language.
Popularity of C, C++ and Java according to TIOBE Index.
C vs C++ vs Java
The languages are based on each other but still, they are different in design and philosophy. The
following table describes the major differences between C, C++, and Java. It will help you to select
which language you have to learn.
S.N. Basis C C++ Java
1 Origin The C language is The C++ language is The Java
based on BCPL. based on the C programming
language. language is based on
both C and C++.
2 Programming It is a procedural It is an object- It is a pure object-
Pattern language. oriented oriented
programming programming
language. language.
3 Approach It uses the top-down It uses the bottom- It also uses the
approach. up approach. bottom-up approach.
4 Dynamic or It is a static It is also a static It is a dynamic
Static programming programming programming
language. language. language.
5 Code The code is executed The code is The code is executed
Execution directly. executed directly. by the JVM.
6 Platform It is platform It is platform It is platform-
Dependency dependent. dependent. independent because
of byte code.
7 Translator It uses a compiler It also uses a Java uses both
only to translate the compiler only to compiler and
code into machine translate the code interpreter and it is
language. into machine also known as an
language. interpreted language.
8 File It generates the .exe, It generates .exe file. It generates .class file.
Generation and .bak, files.
9 Number of There There There
Keyword are 32 keywords in are 60 keywords in are 52 keywords in
the C language. the C++ language. the Java language.
10 Source File The source file has The source file has a The source file has
Extension a .c extension. .cpp extension. a .java extension.
11 Pointer It supports pointer. It also supports Java does not support
Concept pointer. the pointer concept
because of security.
12 Union and It supports union and It also supports It does not support
Structure structure data types. union and structure union and structure
Datatype data types. data types.
13 Pre-processor It uses pre-processor It uses pre- It does not use
Directives directives such as processor directives directives but uses
#include, #define, such as #include, packages.
etc. #define, #header,
etc.
14 Constructor/ It does not support It supports both It supports
Destructor constructor and constructor and constructors only.
destructor. destructor.
15 Exception It does not support It supports It also supports
Handling exception handling. exception handling. exception handling.
16 Memory It uses the calloc(), It uses new and It uses a garbage
Management malloc(), free(), and delete operator to collector to manage
realloc() methods to manage the the memory.
manage the memory. memory.
17 Overloading It does not support Method and Only method
the overloading operator overloading can be
concept. overloading can be achieved.
achieved.
18 goto It supports the goto It also supports the It does not support
Statement statement. goto statement. the goto statements.
19 Used for It is widely used to It is widely used for It is used to develop
develop drivers and system web applications,
operating systems. programming. mobile applications,
and windows
applications.
20 Array Size An array should be An array should be An array can be
declared with size. declared with size. declared without
For example, int declaring the size. For
num[10]. example, int num[].
Next TopicJava String Max Size