Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Sunil Garg   on Jun 13 In Java Category.

  
Question Answered By: Guadalupe Rogers   on Jun 13

I have to tell you some history inorder to make you understand why java  is
platform independent. You see, every application is compiled to native code,
whether they are written in C,C++, or assembly language(Java does n't include in
this list). A native code is just what processor understands. It is just binary
numbers that signify different numbers for different operations. These numbers
are called operation codes or opcodes for short. So, when these opcodes are
passed to CPU, it will do specified things. Now each operating system has
different library for programmers to write applications on top of that
particular operating system. So an application developed for one
platform(operating system) cannot run over another platform. There are some
libraries that allow this, but still the programmer cannot release a single
application to run on different operating systems. So programs written in C, C++
are not platform  independent.
Now Java and ..NET are a bit different. They doesn't compile a source file
into Native opcodes. They simply compile them into some other format, which is
some way in between native code and source code, which is called byte code. Now,
a special piece of software called Java Virtual Machine(JVM) is being developed,
which converts this byte code into machine native code. So the byte code is a
portable format. i.e., it will run on every platform where Java Virtual Machine
exists. This makes Java platform independent. I think you understood now.

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Why java is platform independent ? Or get search suggestion and latest updates.


Tagged: