Object vs Class

Object vs Class

ClassObject
DefinitionBlueprint for creating objectsInstance of a class
public class Main {
    public static void main(String[] args) {
        Car myCar = new Car("Toyota", 2000);
        myCar.displayInfo(); // Make by Toyota in 2000
    }
}

class Car {
    private String make;
    private int year;

    public Car(String make, int year) {
        this.make = make;
        this.year = year;
    }

    public void displayInfo() {
        System.out.println("Make by " + make + " in " + year);
    }
}