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. 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. assert false;
  18.  
  19. // your code goes here
  20. MutableArray ma = new MutableArray();
  21. assert ma.getValues() == null;
  22.  
  23. int[] arrayRef = ma.getValues();
  24. assert arrayRef == null;
  25.  
  26. arrayRef = new int[5];
  27. arrayRef[0] = 42;
  28. assert arrayRef != null;
  29. assert arrayRef[0] == 42;
  30.  
  31. assert ma.getValues() != null;
  32. assert ma.getValues()[0] == 42;
  33. }
  34. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
Standard output is empty