fork(2) 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 MutableArray
  9. {
  10. private int[] values;
  11. public int[] getValues() {
  12. return values;
  13. }
  14.  
  15. public static void main (String[] args) throws java.lang.Exception
  16. {
  17. // your code goes here
  18. MutableArray ma = new MutableArray();
  19. assert ma.getValues() == null;
  20.  
  21. int[] arrayRef = ma.getValues();
  22. assert arrayRef == null;
  23.  
  24. arrayRef = new int[5];
  25. arrayRef[0] = 42;
  26. assert arrayRef != null;
  27. assert arrayRef[0] == 42;
  28.  
  29. assert ma.getValues() != null;
  30. assert ma.getValues()[0] == 42;
  31. }
  32. }
Success #stdin #stdout 0.05s 4386816KB
stdin
Standard input is empty
stdout
Standard output is empty