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

Programming & Frameworks

Topics Covered
  • C Programming and Data Structures (41 Blogs)
  • Comprehensive Java Course (2 Blogs)
  • Java/J2EE and SOA (324 Blogs)
  • Spring Framework (8 Blogs)
SEE MORE

MI-new-launch

myMock Interview Service for Real Tech Jobs

myMock-widget-banner-bg

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

Last updated on Nov 26,2019 8K Views
Aayushi Johari
A technophile who likes writing about different technologies and spreading knowledge. A technophile who likes writing about different technologies and spreading knowledge.
8 / 11 Blog from Introduction to Java

MI-new-launch

myMock Interview Service for Real Tech Jobs

myMock-mobile-banner-bg

myMock Interview Service for Real Tech Jobs

  • Mock interview in latest tech domains i.e JAVA, AI, DEVOPS,etc
  • Get interviewed by leading tech experts
  • Real time assessment report and video recording

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 be comparing the differences between C, C++ and Java so you can choose one or more for a probable career or a 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 up, let’ us take a 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<iostream.h> // header file for input output
#include<conio.h>
main() // header file for console inout output
{
clrscr(); // clears screen
cout<<”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 make use of 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 “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, for becoming a besides this java interview questions, we come up with a curriculum which is designed for students and professionals who want to be a Java Developer. The course is designed to give you a head start into Java programming and train you for both core and advanced Java concepts along with 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.

Comments
0 Comments

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.