What
is platform independence? Explain why java is secure and platform independent.
Ans
Platform
independent means the execution of the program is not restricted by the type of
os environment provided...thereby, make it possible to process the program at
any type of environement available.
Java is
a platform independent language becoz of the bytecode magic of java. In
java, when we execute the source code...it generates the .class file comprising
the bytecodes. Bytecodes are easily interpreted by JVM which is available with
every type of OS we install.
Whereas
C and C++ are complied languages which makes them platform dependent. The
source code written in C / C++ gets transformed into an object code which is
machine and OS dependent. That's the reason why C and C++ languages are termed
as Platform Dependent.
In
Java, the source program is first compiled that generates BYTE CODE which is
common for all platform. The Byte code is given to JVM (Interpreter) each
platform has its own JVM. which converts byte code into machine language that
can be understood by the particular machine only. Once the machine having JVM
it can run any java program. In C, C++ the source program directly compiled into
machine code, which is platform dependent.
No comments:
Post a Comment