We have understood what is Java, now we should learn how Java works as a programming language as well as framework. Java works in two steps
- Step 1 – Write code in Java(English like) language, then compile the code into platform independent intermediate language called bytecode
- Step 2 – During code execution, JVM interprets these bytecode to machine language

Lets learn about some terms used in Java
- JDK – Java Development Kit(JDK) is the tool/software required to compile and execute Java code
- JVM – Java Virtual Machine(JVM) is system specific virtual machine, capable of producing machine code from platform independent bytecode
- JRE – Java Runtime Environment(JRE) the combination of JVM and required libraries to execute a Java program. Kind of provide utensils, spices in kitchen while cooking
- javac – javac is the compiler that compiles Java code into bytecode
- java – This is the java interpreter responsible for executing bytecode into machine code inside JVM with help of other libraries

Lets understand the process
1
Write code using Java programming language. It need to follow Java programming rules like having main method
2
Compile the code using javac, and as we know the outcome is bytecode. Also we need to understand, compilation is part of JDK
3
Compiled code is ready for execution in JRE using java. Inside JRE, JVM interprets bytecode into machine code with help of some other additional libraries. We need JVM in Development environment to compile Java code, but in for execution JRE is enough
4
So far I have been talking about a single Java file. But a software is made out of hundreds or thousands of classes. Mostly we use smart IDE to write all the required Java code
5
All the classes need to be compiled and packaged into a single file(archive) called Java Archive(jar) or Web Application Archive(war). And the jar or war file is executed to run the software