C vs C++ vs Java — Battle of the Best

Swatee Chand
Edureka
Published in
3 min readJun 24, 2019

Software development has seen a transition like any domain out there. This has also resulted in the evolution of programming languages. C, C++, and 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

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 programs to display the differences between C, C++, and Java.

Sample Program in C, C++, and Java

Hello World Program in C

#include<stdio.h> //header file for standard input outputmain() //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 input 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 the 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 wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, Python, Ethical Hacking, then you can refer to Edureka’s official site.

1. Object Oriented Programming

2. Inheritance in Java

3. Polymorphism in Java

4. Abstraction in Java

5. Java String

6. Java Array

7. Java Collections

8. Java Threads

9. Introduction to Java Servlets

10. Servlet and JSP Tutorial

11. Exception Handling in Java

12. Advanced Java Tutorial

13. Java Interview Questions

14. Java Programs

15. Kotlin vs Java

16. Dependency Injection Using Spring Boot

17. Comparable in Java

18. Top 10 Java frameworks

19. Java Reflection API

20. Top 30 Patterns in Java

21. Core Java Cheat Sheet

22. Socket Programming In Java

23. Java OOP Cheat Sheet

24. Annotations in Java

25. Library Management System Project in Java

26. Trees in Java

27. Java Tutorial

28. Top Data Structures & Algorithms in Java

29. Java Developer Skills

30. Top 55 Servlet Interview Questions

31. Top Java Projects

32. Java Strings Cheat Sheet

33. Nested Class in Java

34. Java Collections Interview Questions and Answers

35. How to Handle Deadlock in Java?

36. Top 50 Java Collections Interview Questions You Need to Know

37. Java Tutorial

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

39. Palindrome in Java- How to check a number or string?

40. Top MVC Interview Questions and Answers You Need to Know

41. Top 10 Applications of Java Programming Language

42. Deadlock in Java

43. Square and Square Root in Java

44. Typecasting in Java

45. Operators in Java and its Types

46. Destructor in Java

47. Binary Search in Java

48. MVC Architecture in Java

49. Hibernate Interview Questions And Answers

Originally published at https://www.edureka.co on June 24, 2019.

--

--