difference between C++ and java .

Following are the major differences between C++ and Java.

Java does not support pointers, unions, operator overloading and structure.C++ supports pointers, unions, operator overloading and structure.
Java supports garbage collection.C++ does not supports garbage collection.
Java is platform independent.C++ is platform dependent.
Java supports inheritance except for multiple inheritanceC++ supports inheritance including multiple inheritances
Java is interpreted.C++ is compiled.
Java does not support destructorC++ supports destructors.

Example of C++ program:

{ / #include <iostream>  

using namespace std;  

int main() {  

   cout << “Hi C++ Programming”;  

   return 0;  



Example of java program:

class Gk{  

    public static void main(String args[]){  

     System.out.println(“Hi Java”);  



Leave a Reply