What is the difference between C++ & Java?

What is the difference between C++ & Java?

1. Java does not support Enums, Structures or Unions but supports classes.

2. Java does not support multiple inheritance or operator overloading.

3. Java allows functions to be overloaded.

4. In java, memory leaks are prevented by automatic garbage collection.

5. C++ allows direct calls to be made to the native system libraries. On the other hand java calls these libraries trough java native interface.

6. In c++ parameters are passed by either value or pointers. In java, due to the absence of pointers, parameters are passed by value.

What is the difference between C++ & Java?

- Java does not support typedefs, defines, or a preprocessor. The declaration of named constants is supported in Java through use of the final keyword.

- Java supports classes, but does not support structures or unions.

- Global functions and global data are not allowed in Java.

- All classes in Java ultimately inherit from the Object class. C++ can have inheritance trees that are completely unrelated to one another.

- The interface concept is not supported by C++.

- Java does not support multiple inheritance.

- Java does not support the goto statement. However, it does support labeled break and continue statements, a feature not supported by C++.

- Java does not support operator overloading.

- Java does not support automatic type conversions (except where guaranteed safe).

- Unlike C++, Java has a String type, and objects of this type are immutable.

- Java does not support pointers

- The scope resolution operator (::) like in C++ is not used in Java.

- The size of each primitive type is the same regardless of the platform.

- There is no unsigned integer type in Java.

- C++ requires that classes and functions be declared before they are used. This is not necessary in Java.

- There are no destructors in Java.

- Unlike C++, Java has built-in support for program documentation.

- Java is more robust than C++.

What are the main differences between Java and C++?

he main differences between Java and C++ are

1. Pointers are supported by C++, where as Java does not pointers.

2. Operator overloading and multiple inheritance are supported by java where as Java does not.

3. Java is a platform independent language, where as C++ depends on different platforms and machines.

4. Java utilizes both compiler and interpreter, where as C++ is only compiler.

5. Java has data type boolean, where as C++ does not.
What is JAR file?
What is JAR file? - JAR is a Java Archived file which allows many files to be stored. All applets and classes can be stored...
What is JNI?
What is JNI? - Java Native Interface is a framework that allows the Java code running in the Java Virtual Machine to interact..
What is serialization?
What is serialization? - Serialization is an operation in which an object’s internal state is converted into a stream of bytes.........
Post your comment