重新定义( Override)方法 public class simplearray i protected int[] array public SimpleArray (int i)t array= new int[i]氵 public void setTlement(int i, int data) t array [i data public class SafeArrayextends simpleArray i //重新定义setE1 ement() public void setElementint i, int data)( if(i< arraylength) super setTlement(i data)i重新定义(Override)方法 public class SimpleArray { protected int[] array; public SimpleArray(int i) { array = new int[i]; } public void setElement(int i, int data) { array[i] = data; } .... } public class SafeArrayextends SimpleArray { … //重新定义setElement() public void setElement(int i, int data) { if(i < array.length) super.setElement(i, data); } .... }