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. class A{
  8. private int value;
  9. public A(int v){
  10. value = v;
  11. }
  12. @Override
  13. public String toString(){
  14. return String.valueOf(value);
  15. }
  16. }
  17.  
  18. /* Name of the class has to be "Main" only if the class is public. */
  19. class Ideone
  20. {
  21. public static void fill(A[] table){
  22. for(int i = 0;i<table.length;i++){
  23. table[i]=new A(i);
  24. }
  25. }
  26.  
  27.  
  28. public static void main (String[] args) throws java.lang.Exception
  29. {
  30. int size = 10;
  31. A[] table = new A[size];
  32. fill(table);
  33. for(A a : table){
  34. System.out.println(a);
  35. }
  36. }
  37. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
0
1
2
3
4
5
6
7
8
9