top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between C++ and Java?

+2 votes
379 views
What is the difference between C++ and Java?
posted Jan 22, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The main difference between Java and C++:

  1. Java is a true and complete object oriented language. C++ is an extension of C with object oriented behavior. C++ is not a complete object oriented language as that of Java.

  2. Java does not provide template classes.C++ offers Template classes.

  3. Java supports multiple inheritance using interface. C++ achieves multiple inheritance by permitting classes to inherit from multiple classes.

  4. Java does not provide global variables. Global variables can be declared in C++.

  5. Java does not support pointers.C++ supports pointers.

  6. In Java, destruction of objects is performed in finalize method. In C++, destruction of objects is performed by destructor function.

  7. Java doesn’t provide header files. C++ has header files.

  8. Java is intrinsecally "write once run everywhere", while most C++ programs (especially mature software that was not born with cross-platformness in mind) can be work some to port to other platforms.

  9. There is no goto statement in Java.

  10. Exception and Auto Garbage Collector handling in Java is different because there are no destructor into Java.

  11. Java has method overloading, but no operator overloading just like c++.

answer Jan 22, 2014 by Amit Kumar Pandey
...