Phase VI
Objects
Define reference types, construct valid objects, and trace identity, calls, and copying.
A class defines a type whose state and behaviour belong together. This phase follows an object from allocation through construction, aliasing, method calls, and measured memory layout. It separates reference values from objects, proves that Java always passes arguments by value, and names the ownership rules behind static and final.
When you finish this phase you can
- Define a class as a reference type with instance state, behaviour, and construction rules
- Trace allocation, default field values, initialization, and the reference produced by new
- Distinguish a compiler-provided default constructor from a declared no-argument constructor
- Chain this and super constructor calls, then predict field, block, and constructor order
- Prove Java passes every argument by value, including copied reference values
- Distinguish aliasing, shallow copying, deep copying, and defensive copying
- Measure one JVM object layout with JOL and state the configuration behind the result
- Explain class initialization, static ownership, final assignment, and compile-time constants
- 6.1Classes, Objects, and `new`A class defines a type with state and behaviour. Each object is one instance of that type, with its own fields.Class
- 6.2Constructors, Chaining, `this`Constructors establish an object's starting state. Chaining keeps that work and its validation on one path.Constructor
- 6.3Objects in Memory: Size, Copying, PassingReference values explain aliasing, argument passing, copying, and why measured object size depends on the JVM.Java is always call by valueShallow vs deep copy
- 6.4`static` and `final`Static members belong to a class-level context. Final restricts reassignment, overriding, or inheritance, depending on where it appears.staticfinal