Java/J2EE and SOA (349 Blogs) Become a Certified Professional
AWS Global Infrastructure

Programming & Frameworks

Topics Covered
  • C Programming and Data Structures (16 Blogs)
  • Comprehensive Java Course (4 Blogs)
  • Java/J2EE and SOA (346 Blogs)
  • Spring Framework (8 Blogs)
SEE MORE

What is the difference between C, C++ and Java?

Last updated on Sep 27,2023 59.2K Views

Aayushi Johari
A technophile with a passion for unraveling the intricate tapestry of the... A technophile with a passion for unraveling the intricate tapestry of the tech world. I've spent over a decade exploring the fascinating world of...
8 / 11 Blog from Introduction to Java

Software development has seen transition like any domain out there. This has also resulted in the evolution of programming languages. C, C++, and Java are three languages that have defined programming paradigms with time and yet hold great value in the market. In this article, I will compare the differences between C, C++ and Java so you can choose one or more for a probable career or a Java certification.

Differences between C, C++ and Java

MetricsCC++Java

Programming Paradigm

Procedural language

Object-Oriented Programming (OOP)

Pure Object Oriented Oriented

Origin

Based on assembly language

Based on C language

Based on C and C++

Developer

Dennis Ritchie in 1972

Bjarne Stroustrup in 1979

James Gosling in 1991

Translator

Compiler only

Compiler only

Interpreted language (Compiler + interpreter)

Platform Dependency

Platform Dependent

Platform Dependent

Platform Independent

Code execution

Direct

Direct

Executed by JVM (Java Virtual Machine)

Approach

Top-down approach

Bottom-up approach

Bottom-up approach

File generation

.exe files

.exe files

.class files

Pre-processor directives

Support header files (#include, #define)

Supported (#header, #define)

Use Packages (import)

keywords

Support 32 keywords

Supports 63 keywords

50 defined keywords

Datatypes (union, structure)

Supported

Supported

Not supported

Inheritance

No inheritance

Supported

Supported except Multiple inheritance

Overloading

No overloading

Support Function overloading (Polymorphism)

Operator overloading is not supported

Pointers

Supported

Supported

Not supported

Allocation

Use malloc, calloc

Use new, delete

Garbage collector

Exception Handling

Not supported

Supported

Supported

Templates

Not supported

Supported

Not supported

Destructors

No constructor neither destructor

Supported

Not supported

Multithreading/ Interfaces

Not supported

Not supported

Supported

Database connectivity

Not supported

Not supported

Supported

Storage Classes

Supported ( auto, extern )

Supported ( auto, extern )

Not supported

That’s all with the differences between C, C++, and Java. I hope you are clear with the basic concepts of these wonderful programming languages and helped you in adding value to your knowledge.

Next, let’ us look at some sample program to display the differences between C, C++ and Java.

Sample Program in C, C++ and Java

 

Hello Word Program in C

#include<stdio.h> //header file for standard input output

main() //main method
{
clrscr(); //clears screen
printf(“hello world”); //print statement
getch(); //get the character
}

Explanation: In the above code, you use header file <stdio.h> for standard input output to implement commands like printf and getch.

Hello World Program in C++

#include&lt;iostream.h&gt; // header file for input output
#include&lt;conio.h&gt;
main() // header file for console inout output
{
clrscr(); // clears screen
cout&lt;&lt;”hello world”; //print statement
getch(); // get the character
}

Explanation: In C++, instead you use header file <iostream.h>, <conio.h> for input output and console input output so that you can implement commands like cout and cin. It is similar to printf and scanf in C programming language.

Hello World Program in Java

class edureka // create class
{
public static void main(String args[]) //main method
{
System.out.print(“welcome”); //print statement
}
}

Explanation: In Java, you use classes and objects as it is a pure Object-oriented programming language. You call the main function as it is the entry point to your code.

If you found this article on the “difference between C, C++ and Java” relevant, Check out the Java Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. We are here to help you with every step on your journey. Besides these Java interview questions, we devised a curriculum designed for students and professionals who want to be Java developers. The course is designed to give you a head start into Java programming and train you for core and advanced Java concepts and various Java frameworks like Hibernate & Spring.

Got a question for us? Please mention it in the comments section of this “difference between C, C++ and Java” article and we will get back to you as soon as possible.

Upcoming Batches For Java Course Online
Course NameDateDetails
Java Course Online

Class Starts on 28th September,2024

28th September

SAT&SUN (Weekend Batch)
View Details
Comments
0 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

What is the difference between C, C++ and Java?

edureka.co