Lect 2
Lect 2
{.class file} and executable code {.java file} can run on all operating
systems.
Compilation and Execution of Java Program
• Whenever, a program is written in JAVA, the javac compiles it and
gives .class file or the bytecode and it is machine non native code.
• Every system has its own JVM which gets installed automatically when
the jdk software is installed. For every operating system separate JVM is
available which is capable to read the .class file or byte code. JVM is
platform-dependent and hence Java is able to become “Platform
Independent”.
Difference between JVM, JDK, JRE and JIT.
• Java Development Kit (JDK) contains JRE , various development tools
like Java libraries, Java source compilers, Java debuggers, bundling
and deployment tools.
JVM is heart of JAVA
• JDK is for development purpose whereas JRE is for running the java
programs.
• JDK and JRE both contains JVM so that we develop and run our java
program.
• JIT compiles bytecode to native machine code to optimize efficiency.
2. Classes, interfaces, arrays, enumerations, and, annotations are reference types in Java.
Reference variables hold the objects/values of reference types in Java.
3. Reference variable can also store null value. By default, if no object is passed to a reference
variable then it will store a null value.
4. You can access object members using a reference variable using dot syntax.