The basic syntax of a Java program is as follows:
public class ClassName {
public static void main(String[] args) {
// code you want to execute
}
}
Note: The class name should be exactly the same as the file name.
How JAVA Code gets Executed :
1) Compilation
SOURCE CODE ———> JAVA COMPILER ———> BYTE CODE
(*.java) (**.class)
2) Execution
BYTE CODE ———> JAVA VIRTUAL MACHINE ———> NATIVE CODE
(*.class) (Windows, Mac, Linux)
A Few Things to Know About Java
- JAVA was developed by James Gosling in 1995 at Sun Micro Systems, which was later acquired by Oracle in 2010.
- It was originally called OAK, after an Oak Inc. that stood outside Gosling's office. Later, it was renamed Green and then finally renamed Java, inspired by Java Coffee.
JAVA EDITIONS
- Standard Edition (SE):
- This is the core platform used for beginners' learning stage. It contains all of the libraries that every Java developer should learn.
- Enterprise Edition (EE):
- It is used for building very large-scale and distributed systems.
- It's built on SE and provides additional libraries for building fault-tolerant, distributed multi-tier software.
- Micro Edition (ME):
- It is a subset of SE designed for mobile devices.
- Java Card:
- It is used in smart cards