Problems | Questions |
---|---|
Problem 1 | Why is Java so Popular? |
Problem 2 | What is Platform Independence? |
Problem 3 | What is ByteCode? |
Problem 4 | Compare JDK vs JVM VS JRE. |
Why is Java so Popular? Two main reasons for popularity of Java are 1. Platform Independence 2. Object Oriented Language
What is Platform Independence?
Platform Independence is also called build once, run anywhere. Java is one of
the most popular platform independent languages. Once we compile a java program
and build a jar, we can run the jar (compiledjava program) in any Operating
System - where a JVM is installed.Java achieves Platform Independence in a
beautiful way. On compiling a java file the output is a class file- which
contains an internal java representation called bytecode.
JVM converts bytecode to executable instructions. The executable instructions
are different in different operating systems. So, there aredifferent JVM's
for different operating systems. A JVM for windows is different from a JVM
for mac.However, both the JVM's understand the bytecode and convert it to the
executable code for therespective operating system.
What is ByteCode? Java bytecode is the instruction set of the Java virtual machine. Each bytecode is composed of one, or in some cases two bytes that represent the instruction (opcode), along with zero or more bytes for passing parameters.
Compare JDK vs JVM VS JRE.
1. JVM
a. Virtual machine that run the Java bytecode.
b. Makes java portable.
2. JRE
a. JVM + Libraries + Other Components
(to run applets and other java applications)12 Java Interview Questions and
JDK
a. JRE + Compilers + Debuggers