Introduction to Java
Java is a general-purpose, object-oriented language that runs on the Java Virtual Machine. It powers enterprise systems, Android apps and big-data tools.
On this page · 5 min · Beginner
On this page
- In simple words
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Beginner
- Updated
- Oct 30, 2026
Related tutorials
In simple words#
Java code is like a film recorded in a universal format (bytecode). Any device with the right player (the JVM) can play it — Windows, Linux or Mac — without re-recording.
- JVM
- Java Virtual Machine — runs bytecode.
- Bytecode
- .class files produced by the compiler.
- JDK
- Development kit: compiler (javac) + tools + JVM.
Learning objectives#
- Explain how Java code runs
- Name the JDK, JRE and JVM
- Write and run Hello World
- Know where Java is used
Explanation#
You write .java source files; javac compiles them to bytecode (.class files); the JVM runs the bytecode on any operating system.
The JIT (just-in-time) compiler inside the JVM turns hot bytecode into fast machine code while the program runs.
Java is statically typed and object-oriented, with automatic memory management (garbage collection).
Uses: banking and enterprise back ends (Spring Boot), Android apps, big data (Hadoop, Kafka), and tools like IntelliJ IDEA.
Code example: Hello World#
public class Hello {
public static void main(String[] args) {
String name = "Techie Babaji";
System.out.println("Namaste from Java, " + name + "!");
}
}
// Compile and run:
// javac Hello.java → creates Hello.class (bytecode)
// java Hello → the JVM runs it
// Java 11+ can also run a single file directly: java Hello.java
Namaste from Java, Techie Babaji!
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- Every program starts in a class.
- main is the entry point the JVM calls.
- System.out.println prints a line.
- javac compiles; java runs.
Real-world use case#
Most Indian IT services companies and banks run large Java back ends; Java skills open many job opportunities.
Common mistakes#
public class Hello must be in Hello.java.
Java is case-sensitive: System, not system.
Best practices#
- Use a current LTS JDK (21 or 25)
- Use an IDE like IntelliJ IDEA or VS Code
- Follow naming conventions (PascalCase classes)
- Practise with small programs daily
Remember this#
.java → javac → .class → JVM.
main(String[] args) is the starting point.
Write once, run anywhere.
Practice exercise#
Your task: Change the program to print your name and city on two lines.
Show solution
System.out.println("Name: Asha");
System.out.println("City: Pune");
Mini quiz#
What does javac produce?
Want more? Practise all Java MCQs · Java interview questions
My notes#
Saved in this browser.