Both Java and C++ are efficient programming languages that use object-oriented programming(OOPs) paradigm. Java follows OOPs more than C++. Both support OOPs features like:

  • Classes
  • Objects
  • Polymorphism
  • Encapsulation
  • Abstraction
  • Abstraction

In this article, we are going to discuss the platform independence of Java and why C++ is not supporting platform independency.

Before knowing why java is platform independent let’s have some brief about compiler phases:

We have heard that java is developed to eliminate the various drawbacks of C, C++. Although Java has mostly inherited its syntax from C++ and some major features as well. Java is preferred in almost all major organizations because it supports “code once, runs anywhere” made it platform-independent and easy to use and upgrade.

Before knowing why java is platform independent let’s have some brief about compiler phases:

Semantic Analyser:

Interpret symbols, their types, and their relations with each other.

Intermediate Code Generation:

In the analysis-synthesis model of a compiler, the front end of a compiler translates a source program into an independent intermediate code.

Code Optimizer:

It transforms the code and tries to improve the code by making it consume fewer resources (i.e. CPU, Memory) and deliver high speed.

Target Code Generation:

Use the optimized intermediate code and generates target code or machine code on which machine can operate easily.

  • Don’t Know Where to Go?
  • We’ll Sit and Talk
  • And Find The Solution
  • People And Opportunities

Where do we use Java or C++:

Java:

  • Use java where you have a large codebase to handle.
  • Where you are integrating your application software to multiple platforms use java.
  • Where you have a great extension plan for your application software.

C++:

  • Where you need to interact with memory very often.
  • You need to create the OS for your organization.

Leave a Comment