Simple, Object-Oriented, Robust & Architecture-Neutral
The source code of Java (.java file(s)) is compiled by the Java compiler into a bytecode (.class file(s)). This bytecode can run on any OS, but JRE(Java Runtime Environment) must be installed on the OS.
This JRE is different for different OS such as Linux, Windows or Mac, but the bytecode generated will be same for all OS. So, JRE is architecture dependent but the bytecode is architecture neutral, i.e. will be same for every machine or OS.
A Java compiler generated intermediate code, which can execute on any OS, regardless of its OS.
JVM: It is an abbreviation for Java Virtual Machine, it is an abstract machine (a software) which provides the runtime environment in which java bytecode can be executed. It is a specification. JVMs are available for many hardware and software platforms (so JVM is platform dependent/architecture dependent).
JRE: It stands for Java Runtime Environment. It is the implementation of JVM.
JDK: It is an acronym for Java Development Kit. It is basically a complete set of development tools necessary for developing & executing Java programs. It contains JRE in itself.
Just-In-Time(JIT) compiler: It is used to improve the performance. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation.Here the term “compiler†refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.
JVM calls the main method in Java. Main method in Java is the starting point of standalone core Java Application. JVM starts executing main method and the thread which executes main is called main thread in Java.
public is an access modifier. static is a keyword which suggests only one copy will be maintained and the method would be called with class name and not with its object. void indicates return type, it returns nothing main is the name of the method String args[] represents an array of string type, named args
The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused.
A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.
The program compiles properly but at runtime it will give "main() method not public." message.