Difference between C C++ and Java


1)Language->C is a procedural language,c++ is a object oriented language .Java is a pure object oriented language.

2)Header Files->In C we use stdio.h header file .In C++ we use iostream.h,conio.h headerfile but Java does not support any header files.


3)Platform Independent->C & C++ both are platform dependent that means you can’t run the execute code in any other operating system.Java is a platform independent language.

4)Pointers->Pointers are used in C & C++ language .Java will not support for pointers.

5)Operator overloading->Operator overloading concept is not used in Java but in C++ we use operator overloading.

6)Multiple Inheritance->We use multiple inheritance in C++ not in Java .In Java we use Interface instead of multiple inheritance.

7)Translator->Java uses compiler and interpreter but in C & C++ uses compiler only.

8)Web Application->Internet programming like Frame,Applet is used in Java not in C,C++.

9)Operator->Dot (.)operator is used instead of scope resolution operator.

10)Package->We can create our own package in Java(set of classes) but not in c and c++.

Example of C,C++ and Java .........

Program in C

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

main()               //main method


clrscr();       //clear the screen

printf(“welcome”);   //print the message

getch();   //get the character


Program in C++

#include<iostream.h>   //header file necessary for input output stream

#include<conio.h>     //headerfile for console input output

main()     //main method


clrscr(); //clear the screen

cout<<”welcome”;   //cout is used for output

getch(); //get the character


Program in Java

class main   //program always start with class because of pure object oriented language


public static void main(String aa[])   //main method


System.out.print(“welcome”);   //print the message