[...] class Car { public Engine getEngine(int fuelCapacity) { return new Engine () { private int fuelCapacity = 11; public int getFuelCapacity() { return fuelCapacity; } }; } } [...]