fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. public class Main {
  9.  
  10. public static void main(String[] args){
  11. Test[] arr_t = new Test[1];
  12. arr_t[0] = new Test(10);
  13. Test[] an_arr = arr_t.clone();
  14. an_arr[0]= new Test(5);
  15. System.out.println(an_arr[0].test); //5
  16. System.out.println(arr_t[0].test); //10
  17. }
  18.  
  19. public static class Test{
  20. public int test;
  21. public Test(int test) {
  22. this.test = test;
  23. }
  24. }
  25. }
Success #stdin #stdout 0.11s 320256KB
stdin
Standard input is empty
stdout
5
10