fork download
  1. import java.util.*;
  2.  
  3. class StaticTest {
  4.  
  5. Object[] arr = new Object[] { 1, 2, 3 };
  6.  
  7. static Object[] testMethod() {
  8. //return arr; // you do not have an instance
  9. //return new String[] { "abc", "def" }; // possible
  10. StaticTest o = new StaticTest();
  11. return o.arr;
  12. }
  13.  
  14. public static void main (String[] args) throws java.lang.Exception
  15. {
  16. System.out.println( Arrays.asList( testMethod() ) );
  17. }
  18.  
  19. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
[1, 2, 3]