What is Java?
Java is a high-level, object-oriented, platform-independent programming language created by Sun Microsystems in 1995 (now owned by Oracle). It’s known for its slogan:
βWrite Once, Run Anywhere.β
This means the same Java code can run on any device that has the Java Virtual Machine (JVM).
π οΈ Why Learn Java?
- π Widely used in enterprise software, Android apps, web apps, and IoT
- π Cross-platform capability (Windows, Mac, Linux)
- πΌ High demand in the job market
- βοΈ Strong ecosystem (Spring, Hibernate, Maven, etc.)
- π» Excellent for learning object-oriented programming
π₯ Step-by-Step: Setting Up Java on Your Machine
1. Download and Install JDK
- Go to: https://www.oracle.com/java/technologies/javase-downloads.html
- Download the latest JDK (Java Development Kit) for your OS
- Install it and note down the installation path
2. Set Environment Variables (Windows)
- Open System Properties > Environment Variables
- Add:
JAVA_HOME
β your JDK path- Add
%JAVA_HOME%\bin
to thePath
variable
java -version
javac -version
You should see the installed Java version printed.
4. Choose Your IDE
- IntelliJ IDEA (recommended): fast, modern, and powerful
- Eclipse: classic and widely used
- VS Code: lightweight, with Java plugins
π‘ First Java Program: Hello World
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
Compile
javac HelloWorld.java
Run
java HelloWorld
β What You Learned
- What Java is and why it’s powerful
- How to install JDK
- How to run your first Java program