You need to understand a bit of the lower levels of Java memory organization. On the stack, primitives(int, double, boolean, etc) and object references pointing to the heap are stored.
Inside any object the same is true. It either contains references to other objects or primitives directly. Objects are always references in any context and those references are passed by value.
So we may have:
[ STACK ] [ HEAP ]
int a: 10; -> MyWrapperObject@21f03b70====||
double b: 10.4; | || int someField: 11 ||
MyWrapperObject@21f03b70 ------| || String@10112222 ----------
...... ||==========================|| |
|
|
String@10112222============||<----
|| ... ||
|| ... ||
}}=========================||
Note that use in some cases(as in via JVM internals) objects may be stored in non-heap memory.