locked
Difference between C++ & java RRS feed

  • Question

  • can any one tell me the basic difference between c++ and java
    Thursday, March 15, 2007 10:44 AM

Answers

  • both c++ and java are object oriented languages... the basic difference is that in c++ u can write both procedural programs as well as object oriented programs. but java is a purely object oriented language. and u have to write programs in objects.
    Thursday, March 15, 2007 10:51 AM

All replies

  • both c++ and java are object oriented languages... the basic difference is that in c++ u can write both procedural programs as well as object oriented programs. but java is a purely object oriented language. and u have to write programs in objects.
    Thursday, March 15, 2007 10:51 AM
  • some more differences are :

    1. you can run java programs remotely, which is not the case for C++ programs.

    2. java is more flexible and secure.

    3. array bounds and some standards errors such as division by zero kind of errors are handled by pre-defined exception handler.

    4. java in platform independent, which is not the case for C++.

    Thursday, March 15, 2007 11:21 AM
  • In java u cant use Multiple Inheritance. Also Packages and interfaces are some additions in Java which are not in C++.

    Java is used mainly for internet applications - Applets..

    Thursday, March 15, 2007 1:50 PM
  • C++ is object baased language but java is purely object oriented.It is flexible and has many features for a wide variety of use.Most importantly it is PORTABLE so with the help of jvm it can be run on any platform

    Thursday, March 15, 2007 5:21 PM
  • Perhaps the single biggest difference between Java and C++ is that Java does not support pointers.  Pointers are inherently insecure and troublesome.  Since pointers do not exist in Java, neither does the -> operator.  Some other C++ features are not found in Java.

    :Java does not include structures or unions because the class encompasses these other forms.  It is redundant to include them.
    :Java does not support operator overloading.
    :Java does not include a preprocessor or support the preprocessor directives. 
    :Java does not perform any automatic type conversions that result in a loss of precision. 
    :All the code in a Java program is encapsulated within one or more classes.  Therefore, Java does not have global variables or global functions.
    :Java does not support multiple inheritance.
    :Java does not support destructors, but rather, add the finalize() function.
    :Java does not have the delete operator.
    :The << and >> are not overloaded for I/O operations.
    :Java does not support templates.

    Thursday, March 15, 2007 5:33 PM
  • A better question would have been whats the difference between C# and JAVA. Almost nothing :P.
    Friday, March 16, 2007 7:40 AM