Hey everyone
!! In my previous post I have discussed about some basic terminologies about
java and the next topic is Platform Dependency and In-dependency. In this post I
will explain you all that actually what is a platform, why java is called
platform independent language, why c and c++ are not in this category.
PLATFORM:
It is an
environment in which a program is loaded and executed, and the output is generated.
The platform can be a software based or hardware based.
C program is
compiled by OS. It means that C programming compiled code is directly executed
by the OS. C++ is the advance version of C language only so the c++ program
platform is also OS. Its code is also executed by OS
Java Program
platform is JVM i.e. Java Virtual Machine. It means java program compiled code
is executed by special software called JVM, but not by operating system. To run
java program in our system we must install JVM.
Note:- We
call java a platform Independent language but the JVM software is a platform
dependent i.e. if you want to run java in your system you must install JVM
which supports the OS which is installed in your system. Sun Microsystems has
designed JVM for all the software's which is available in the market.
.NET program
platform is CLR. It means .net program compiled code is executed by a special
software called CLR but not by the operating system directly.
PLATFORM
DEPENDENCY :-
A simple
program that we develop and compile in one Operating System, if it is not
executed in different Operating System then we called the program as platform
dependent program and the language using which we develop this program is
called platform dependent language.
In simple
words if I want to elaborate it, it will be like suppose there is a group of
friend of five people. One person is has develop a code in his system and also
executed it also if he give the same code to his friend so that he can also
have a look towards it. But when his friend open that code it is not
executable. This is because both the machines are different so the same code
can't be run on another machine. This is called platform dependency.
The above
figure illustrates that we have develop a program in windows operating system
and it can only be executed in windows OS only not in any other OS.
PLATFORM
INDEPENDENCY:-
This is just
the opposite case of the previous one. Suppose if we are developing a program
and it is executed in any other operating system then we call it as a platform
independent program and the language which is used to develop this program is
called as platform independent language. This concept can be illustrated from
the given diagram.
In this
diagram we have developed a program in Windows Operating system and with the
help of JVM it is executed in any other os. Just the requirement is That
particular Operating System must have JVM installed.
WHY C AND
C++ LANGUAGE ARE PLATFORM DEPENDENT :-
C and c++
compiled code is machine language of current Operating System in which it is
compiled one operating system machine language code is different from other
operating system machine language format. The compiled code in one operating
system will not be executed in other operating system.
Not only C
program , C software is also platform dependent because C software contains
compiler, linker and header files, all these components are platform dependent
so C software becomes platform dependent. Let me explain this with you a
diagram
HOW JAVA ACHIEVED
PLATFORM INDEPENDENCY :-
Java
achieved platform in-dependency " By moving machine language generation
from compilation phase to execution phase. For this new compiler software,
byte code and java virtual machine are introduced in java" i.e. Java has
introduced a new concept of jvm which runs the byte code generated by java
compiler and the output is generated irrespective of the operating system.
In java
machine language is moved from compilation phase to execution phase, because
machine language should generate for client Operating System to execute
programming in client computer, client Operating system information information we will get at the time of execution time. Let
me explain all this with the help of a diagram
---------------------------------------------------------------------------------------------------------------------
Title :
JAVA : PLATFORM DEPENDENCY AND IN-DEPENDENCY
Description : Hey everyone !! In my previous post I have discussed about some basic terminologies about java and the next topic is Platform Dependency...
Rating :
5