Chapter 1

Java Architecture, OOP & Exception Handling

Understand JDK vs JRE vs JVM, bytecode, classes, objects, interfaces, packages, and try-catch-finally blocks.

Java: Platform-Independent Enterprise Language

Developed by James Gosling at Sun Microsystems in 1995. Core slogan: Write Once, Run Anywhere (WORA).

Java Architecture:
  • JDK (Java Development Kit): Contains compiler (javac), debugger, and tools for developers.
  • JRE (Java Runtime Environment): Provides class libraries and runtime support to execute code.
  • JVM (Java Virtual Machine): Interprets / JIT-compiles bytecode (.class) into native machine code.
Hands-on Laboratory Procedures & Shortcuts

Follow the steps below to practice directly on your computer.

Complete Java Class with Exception Handling:
public class DivisionDemo {
    public static void main(String[] args) {
        try {
            int a = 10;
            int b = 0;
            int c = a / b;
            System.out.println("Result: " + c);
        } catch (ArithmeticException e) {
            System.out.println("Error: Cannot divide by zero!");
        } finally {
            System.out.println("Execution completed.");
        }
    }
}
Watch the video class above while following along with the practical exercises.
Key Summary & Revision Bullet Points

Quick cheat-sheet to review before online examinations.

• Java is purely object-oriented (everything except primitive data types is an object).
• Memory management is automatic via Garbage Collection.
• Bytecode is stored in .class files.
Frequently Asked Viva & Exam Questions

Review these standard questions frequently asked in diploma exams and job interviews.

Q1: Why is Java platform independent?
Ans: Because the Java compiler produces bytecode rather than native machine language. Any machine with a JVM installed can execute this bytecode.
Interactive Chapter Quiz

Test your mastery immediately! Click an option to see instant answer feedback.

Q1 Who is considered the Father of the Java programming language?
A. Bjarne Stroustrup
B. Dennis Ritchie
C. James Gosling
D. Guido van Rossum
Explanation: James Gosling developed Java at Sun Microsystems in 1995.
Q2 Which component converts Java bytecode into machine code for the host computer?
A. JDK
B. JRE
C. JVM
D. Javac
Explanation: The JVM (Java Virtual Machine) executes the platform-independent bytecode.
Q3 Which block in Java always executes regardless of whether an exception was thrown?
A. try
B. catch
C. finally
D. throw
Explanation: The finally block is guaranteed to execute for cleanup.
Q4 What is the file extension of compiled Java bytecode files?
A. .java
B. .class
C. .exe
D. .obj
Explanation: Compiling a .java file produces one or more .class bytecode files.
Q5 Which keyword in Java is used to inherit a class?
A. implements
B. extends
C. inherits
D. super
Explanation: The extends keyword is used to inherit from a superclass.