No, Java is specifically designed to disallow that... but...
It's not officially supported (and how/whether or not it works likely varies between JVM implementations), but the class sun.misc.Unsafe
allows one to do stuff that you're normally not supposed to be able to do. See this article.
Excerpt:
@Test
public void testCopy() throws Exception {
long address = unsafe.allocateMemory(4L);
unsafe.putInt(address, 100);
long otherAddress = unsafe.allocateMemory(4L);
unsafe.copyMemory(address, otherAddress, 4L);
assertEquals(100, unsafe.getInt(otherAddress));
}
The unsafe.getInt(otherAddress)
call may be the closest thing you can achieve in pure Java.
There was a survey in 2014 about whether or not Unsafe
should gain official support, but I'm not sure what (if anything) came of that.