Basic Java Coding Notes
1. Install Java (JDK)
• Download and install Java JDK from Oracle’s site.
• This gives you javac (compiler) and java (runtime).
2. Choose a Place to Write Code
Option A: Text Editor + Command Line (Notepad/VS Code, save as .java)
Option B: IDE (IntelliJ IDEA, Eclipse, NetBeans) - easier for beginners.
3. Your First Java Program
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
4. Compile & Run (if using command line)
1. Open Command Prompt/Terminal.
2. Navigate to folder: cd path/to/file.
3. Compile: javac HelloWorld.java.
4. Run: java HelloWorld.
5. Java File Structure Basics
• Every Java program lives inside a class.
• The entry point is the main method.
• Statements end with semicolons.
• Curly braces group blocks.
6. Core Concepts to Learn Next
• Variables & Data Types: int age = 18; String name = "Amna";
• Input from user: Scanner sc = new Scanner(System.in);
• If/Else, Loops (for, while), Methods, Classes & Objects, Arrays.