7. แถวลำดับ

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 7-7  เมท็อดเปรียบเทียบสองอาเรย์ว่าเหมือนกันหรือไม่
  public static boolean equals(int[] a, int[] b) {  
    if (a.length != b.length) return false;
    for (int i=0; i<a.length; i++) {
      if (a[i] != b[i]) return false;
    }
    return true;
  }
©2009 S.Prasitjutrakul