Java · Lesson 1 of 9
Java introduction
What Java is used for, the JDK, and the structure of a Java program.
Java is a strongly typed, object-oriented language that runs on the Java Virtual Machine (JVM). Code is compiled to bytecode, which the JVM runs on any operating system — “write once, run anywhere”. It powers large backend systems (Spring Boot), Android apps, banking software and big-data tools, and is one of the most hired-for skills in Technopark and Infopark.
Setup
Install a JDK (Java Development Kit) — version 17 or 21 (long-term support). Check with java -version. IntelliJ IDEA Community and VS Code are popular free editors.
Program structure
- All code lives inside a class.
- Execution starts at
public static void main(String[] args). - Statements end with
;, blocks use{ }, and Java is case-sensitive.
Example program
Run with JDK 17+: java Main.javapublic class Main {
public static void main(String[] args) {
// Print a line of text
System.out.println("Hello from Java!");
System.out.println("2 + 3 = " + (2 + 3));
}
}
Output
Hello from Java!
2 + 3 = 5
Save the code as Main.java and run java Main.java (JDK 11+ runs single files directly). Names and figures are fictional.
Key points
- Java runs on the JVM via bytecode.
- main() is the entry point.
- Every statement ends with a semicolon.
Quick check
Where does a Java program start running?
The JVM calls public static void main(String[] args).
Practice task
Write a program that prints your name, then the number of days in 3 weeks calculated with multiplication.
Interview corner
JDK vs JRE vs JVM?
The JVM runs bytecode. The JRE is the JVM plus core libraries needed to run programs. The JDK is the JRE plus development tools such as the compiler (javac).
Why is Java called platform independent?
Source compiles to bytecode, and any OS with a JVM can run that same bytecode.
Further reading
Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.
Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.