Introduction to Java · Introduction to Java Programming

Starting a Java Program

Watch lectures

Starting a Java Program

1. Steps for Absolute Beginners

  1. Install JDK 17/21, check java -version.
  2. Write Hello.java in Notepad/VS Code.
  3. Compile: javac Hello.java → makes Hello.class.
  4. Run: java Hello (no .class in command!).

2. First Program (typed, not copied)

public class Hello {
    public static void main(String[] args) {
        System.out.println("I am running Java!");
    }
}

3. What Happens Behind

Hello.java (you type) → javac (compiler) → Hello.class (bytecode) → java (JVM) → output

Error? javac: file not found → wrong folder (use cd). Main method not found → spelling of main / String[] args wrong.

4. IDE Shortcut (after command line once)

IntelliJ/Eclipse: New Project → New Class → Run button does javac+java for you. Learn command line first for exams.

5. Exam Points

  • Steps javac/java with commands — 5 marks, very frequent.
  • First program + output — 3 marks, frequent.
  • Common errors (filename, main spelling) — 2-3 marks.
Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.

← All Introduction to Java Programming modules