Skip to content

Differences of Java and C++

Reading Time: 2 minutes

Java and c++

The differences between the java and c++ programming languages can be traced to their heritage, as they have different design goals.

C++
Was designed for systems and applications programming (a.k.a. infrastructure programming), extending the C programming language. To this procedural programming language designed for efficient execution, C++ has added support for statically typed object-oriented programming, exception handling, lifetime-based resource management (RAII), generic programming, and template metaprogramming, in particular. It also added a standard library which includes generic containers and algorithms (STL), as well as many other general purpose facilities.
Java
Is a general-purpose, concurrent, class-based, object-oriented computer programming language that is specifically designed to have as few implementation dependencies as possible. It relies on a Java virtual machine to be secure and highly portable. It is bundled with an extensive library designed to provide a complete abstraction of the underlying platform. Java is a statically typed object-oriented language that uses similar (but incompatible) syntax to C++. It includes a documentation system called Javadoc.

Java:

1.It doesn’t support multiple inheritance.

2.It doesn’t support pointers.

3.objects here can be destroyed using finalize method.

4.It supports method overloading.

5.It is platform independent.Since it is interpreted for most part.

6.There is no go to statement in java.The keywords go to and CONST are reserved.

7.It doesn’t support scope-resolution operator.

8.It supports built-in documentation comments.

9.It supports built-in threads.

C++:

1.It supports multiple inheritance .If ambiguity occurs it can be resolved using virtual keyword.

2.It uses destructive to destroy the object.

See also  malloc vs calloc

3.It supports structures,unions,pointers.

4.It supports both method overloading and operator overloading.

5.It is platform dependent since it generates object code.

6.It has go to statement.However it is not considered good practice to use of  go to statement.

7.It uses scope-resolution operator to define a method outside the class.

8.It doesn’t support documentation comments.

9.It doesn’t support threads.

Leave a Reply