fork(1) 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. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12.  
  13. int[] numbers = new int[]{1,2,3,4,5};
  14.  
  15. System.out.println(numbers);
  16. update(numbers);
  17. view(numbers); // {5,4,3,2,1}
  18. }
  19.  
  20. static void update(int[] nums) {
  21. System.out.println(nums);
  22.  
  23. for(int i=0; i < nums.length; i++) {
  24. nums[i] = 5-i;
  25. }
  26.  
  27. view(nums); // {5,4,3,2,1}
  28. }
  29.  
  30. static void view(int[] nums) {
  31. for(int num : nums) {
  32. System.out.println(num); // {5,4,3,2,1}
  33. }
  34. }
  35. }
Success #stdin #stdout 0.09s 27848KB
stdin
Standard input is empty
stdout
[I@1540e19d
[I@1540e19d
5
4
3
2
1
5
4
3
2
1