fork download
  1. class TestClass {
  2. public void method1 (int[] a, int[] b)
  3. {
  4. a = b;
  5. a[0] = 10;
  6. System.out.println("a[0] = " + a[0]);
  7. System.out.println("b[0] = " + b[0]);
  8. }
  9.  
  10. public void method2 (int x, int y)
  11. {
  12. x = y;
  13. x = 4;
  14. System.out.println("x = " + x);
  15. System.out.println("y = " + y);
  16. }
  17.  
  18. public static void main(String [] args)
  19. {
  20. TestClass test = new TestClass();
  21. int x = 2; int y = 3;
  22. int[] a = new int[] {5,6,5,6};
  23. int[] b = new int[] {1,8,1,8};
  24.  
  25. test.method1(a, b);
  26. test.method2(x, y);
  27.  
  28. System.out.println("x = "+x+"; y = "+y+"; a[0] = "+a[0]);
  29. }
  30. }
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
a[0] = 10
b[0] = 10
x = 4
y = 3
x = 2; y = 3; a[0] = 5