Java is _memory_ safe. You cannot write a buffer overflow in java. When people say java is a "safe" language that's usually shorthand for "memory safe"
What's NullPointerException if not a buffer overflow?
Its not a buffer overflow.
Its more like a software interrupt that prevents the bytes in memory being read or executed. That's a level of safety over what you get in C, where a buffer overflow can lead to remote code execution or data leakage.