- If we write program by using one platform we can execute in the same platform but we cannot execute in different platform.
- Ex. C language.
Platform independent:
- If we write a program by using one platform we can execute in any platform.
- Ex. Java language.
Explain why Java is platform independent ?
Because in Java source code is converted into bytecode which can be executable in any platform which has JVM (Java virtual Machine).
JVM (Java virtual Machine)
- JVM takes bytecode as input and give binary as output.
- JVM physically does not exist.
- JVM is platform dependent but JVM makes Java as platform independent.
- JVM consists of interpreter and JIT (Just In Time) compiler.
- Interpreter
- Interpreter compiles and execute bytecode simultaneously line by line.
- Interpreter takes more time for execution.
- JIT(Just In Time) compiler
- It is used to increase the speed of execution.
- Note:
- It compiles few lines which are having similar functionality then gives to interpreter.
JRE (Java Runtime Environment)
- It provides environment for run and execute Java programs.
- JRE consists of JVM and inbuilt libraries (inbuilt class files)
- JRE physically exist.
JDK (JAVA DEVELOPMENT KIT)
0 Comments