Full Stack Web Development Internship Program
- 29k Enrolled Learners
- Weekend/Weekday
- Live Class
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.
Metrics | C | C++ | 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.
#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.
#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.
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.
Course Name | Date | Details |
---|---|---|
Java Course Online | Class Starts on 14th December,2024 14th December SAT&SUN (Weekend Batch) | View Details |
edureka.co