Buffer Overflows

Memory-Safe Java Code
try {
  String[] array = { "a", "b", "c" };
  array[25] = "z";
}
catch (ArrayIndexOutOfBoundsException e) {
  // Attempts to overflow the buffer will raise an error in Java.
  e.printStackTrace();
}