I don't think Java has the same type of memory safety as Rust. Not unless things have changed drastically?
It doesn't, it merely disallows you from actually managing your memory.