Compilation and Execution
Last updated
Was this helpful?
Last updated
Was this helpful?
During Compilation(Compile time), the compiler convert source code (.java) into bytecode (.class)
Compile Time Error is mainly related to syntax error of source code
During Execution (Run time), the class file will read ,the related class will be loaded and the relevant information (e.g: static variable, method ) will be stored into memory of JVM
Run time Error is mainly related to out of memory, divided by 0 ,dereferencing a null pointer
Finally , the class file will be read line by line , data in memory area , convert into native machine code and be executed by execution engine
JDK(Java Development Kit) : JDK is intended for software developers and includes development tools such as the Java compiler, Javadoc, Jar, and a debugger.
JRE(Java Runtime Environment) : JRE contains the parts of the Java libraries required to run Java programs and is intended for end users. JRE can be view as a subset of JDK.
JVM: JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed. JVMs are available for many hardware and software platforms.
Used to store the address of the object such as String, ...
If heaps is fulled, Out of memory error will be thrown
When the method is executed, a new stack will be created and the local primitive variable and the reference of the object which can be found in heaps will be stored
After execution of the method, the corresponding stack frame will be flushed
Last in First Out
In order to prevent out of memory, as there are many unused objects, the heap memory will be cleared automatically in the background