Java Fundamentals

IB Syllabus: B2.1 — Programming fundamentals


Overview

Before writing programs with loops and arrays, you need to understand the building blocks: variables, data types, operators, and how to get input from the user.

Topic What you learn Syllabus
Variables & Data Types Declaring variables, primitives, Strings, operators, Scanner B2.1.1
String Methods Manipulating text with built-in methods B2.1.2
Exception Handling try/catch/finally for runtime errors B2.1.3
Debugging Print statements, trace tables, breakpoints B2.1.4

How Java Works

Java is both compiled and interpreted — a two-step process:

Your Code (.java)  →  Compiler (javac)  →  Bytecode (.class)  →  JVM  →  Output

The JVM (Java Virtual Machine) reads bytecode and translates it for whichever platform it runs on — this is why Java is “write once, run anywhere.”


Structure of a Java Program

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

Key rules:

  • The class name must match the filename exactly (HelloWorld.java)
  • Java is case-sensitivemain is not Main
  • Every statement ends with a semicolon ;
  • Execution always begins in the main method

Table of contents


Back to top

© EduCS.me — A resource hub for IB Computer Science

This site uses Just the Docs, a documentation theme for Jekyll.