- Understanding what Java is and its history
- Setting up your Java development environment
- Writing your first Java program
- Understanding the basic structure of a Java program
- Running Java programs from command line
Java is a high-level, object-oriented programming language that runs on billions of devices. It's known for its "Write Once, Run Anywhere" capability.
Every Java program has these essential components:
- Class declaration:
public class ClassName - Main method: Entry point of the program
- Statements: Instructions that perform actions
- Java is case-sensitive
- Statements end with semicolons (;)
- Code blocks are enclosed in curly braces {}
- File name must match the public class name
- HelloWorld.java - Your first Java program
- BasicStructure.java - Understanding Java program structure
- Comments.java - Different types of comments in Java
- Open command prompt/terminal
- Navigate to this folder
- Compile:
javac HelloWorld.java - Run:
java HelloWorld
- Modify the HelloWorld program to print your name
- Create a program that prints multiple lines
- Experiment with different comment types
- 'javac' is not recognized: Make sure Java is installed and PATH is set
- File not found: Ensure you're in the correct directory
- Compilation errors: Check for typos and missing semicolons
Next Day: Day 02 - Variables and Data Types