ALL LESSONS Module 7

Classes and Objects Fundamentals

Apr 5, 2026 1 min read

Classes and Objects

Fundamental OOP concepts defining blueprint and instances.

Class Example

public class Car {
    String brand;
    int year;
    
    public Car(String brand, int year) {
        this.brand = brand;
        this.year = year;
    }
    
    public void start() {
        System.out.println(brand + " started");
    }
}

Key Points

  • Class = blueprint, Object = instance.
  • this refers to current object.
  • Constructor has same name as class.
  • Usage: Car myCar = new Car("Toyota", 2023);.

Need help with this lesson? Visit the Discussion Forum