Object
An object is a concrete instance of a class β a piece of memory on the heap that holds the class's fields and responds to its methods. You create one with new ClassName(...).
Reference semantics
Car a = new Car("Toyota", 2022);
Car b = a; // b now refers to the SAME object as a
b.setBrand("Honda");
System.out.println(a.getBrand()); // Honda β same object!
Object variables hold references, not copies. Assignment copies the reference, not the object.
java.lang.Object
Every class in Java implicitly extends java.lang.Object. This gives every object a few methods: toString(), equals(Object), hashCode(), getClass(), wait(), notify(). Override toString, equals and hashCode to give your class meaningful behaviour.
Objects live on the heap
Java allocates all objects on the heap (not the stack). The garbage collector reclaims heap memory when no reference points to an object. You never call free() or delete.
null
A reference typed Car c that isn't pointing anywhere is null. Calling a method on a null reference throws NullPointerException.