In this tutorial we have covered step by step discussion about –
- Which features makes java Platform Independent ?
- Why Java is Platform Independent ?
- Why Java is considered as Secure and Portable Language ?
A. Java is considered as Portable because –
Java is Considered as Platform independent because of many different reasons which are listed below –
- Output of a Java compiler is Non Executable Code i.e Bytecode.
- Bytecode is a highly optimized set of instructions
- Bytecode is executed by Java run-time system, which is called the Java Virtual Machine (JVM).
[box]
Important Note :
As the output of Java Compiler is Non Executable Code we can consider it as Secure (it cannot be used for automated execution of malicious programs).
[/box]
- JVM is an interpreter.
- JVM accepts Bytecode as input and execute it.
- Translating a Java program into bytecode makes it much easier to run a program in a wide variety of environments because only the JVM needs to be implemented for each platform.
- For a given System we have Run-time package , once JVM is installed for particular system then any java program can run on it.
- However Internal details of JVM will differ from platform to platformbut still all understand the Same Java Bytecode.
B. Why Java Code is Safe ?
- Java program is executed by the JVM.
- The JVM prevent java code from generating side effects outside of the system.
- Safety is also enhanced by certain restrictions that exist in the Java language.
C. Interpreter are slower than Compiler
Java Code is Executed by JVM (interpreter).Other programming language uses compiler which can create executable code much faster then why we are using Interpreter.
- When a program is interpreted, it generally runs slower than the same program would run if compiled to executable code.
- In Java Compiler will generate ByteCode which is highly optimized.
- Thus running highly optimized code using interpreter makes execution ofjava program faster.
0 टिप्पणियाँ:
Post a Comment