Module 1: Introduction to Java

Objectives

Java Program Structure

Here's a simple "Hello, World!" program in Java:

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

Java vs. C++: Key Differences

Java

  • Runs on JVM
  • No pointers
  • Garbage collection
  • No header files
  • Platform-independent bytecode

C++

  • Compiled to native code
  • Uses pointers
  • Manual memory management
  • Requires header files
  • Platform-specific binaries

Exercise

Write your own Java class that prints your name and favorite programming language.

Next Steps