clone method in single dimentional array differs from double dimentional array

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P3
    • None
    • Affects Version/s: 1.3.0
    • Component/s: tools
    • x86
    • windows_95



      Name: yyT116575 Date: 12/05/2000


      compiles and runs fine but behaviour seems incosistent.

      class aa{
      public static void main(String arg[])
      {
      int arr[]={1,2,3};
      int arrclone[]=(int[])arr.clone();
      arr[0]=100;
      System.out.println(arr[0]);// op: is 100
      System.out.println(arrclone[0]);// op: is 1

      int arr2[][]=
      {
      {1,2,3},
      {4,5,6}
      };
      int arr2clone[][]=(int[][])arr2.clone();

      arr2[0][0]=100;
      System.out.println(arr2[0][0]);// op: is 100
      System.out.println(arr2clone[0][0]);// op: is 100
      // why does it behave differently for double dimentional arrays???
      //when compared to single dimentional arrays..
      }
      }
      (Review ID: 113281)
      ======================================================================

            Assignee:
            Neal Gafter (Inactive)
            Reporter:
            Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: