Let's assume for a moment that objects may indeed be allocated on the stack:
Now, myObj would be on the stack. And it will get deleted again once doSomething() returns. What should doSomeMore() do to preserve the value so it can be printed in the main method?
The only way this can happen is if enough space is on the heap *somewhere* that can hold obj (and we don't even know how much space this has to be, since the Object passed to doSomeMore could just as well be a
String or any other subclass of Object); and we copy the contents of obj into object, whenever an assignment is made.
Let's say we could magically predict how much space has to be available (through a size variable in Object?), wouldn't you agree that having to copy the entire value of an object is extremely wasteful, compared to just copying a reference? And you *have* to copy the value, because the value ceases to exist once the method is popped from the stack.