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 Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. List<Integer> list = new ArrayList<>();
  13. list.add(1);
  14. list.add(20);
  15. int[] resultado = new int[list.size()];
  16. list.toArray(resultado);
  17. }
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:16: error: no suitable method found for toArray(int[])
		list.toArray(resultado);
		    ^
    method Collection.<T#1>toArray(T#1[]) is not applicable
      (inference variable T#1 has incompatible bounds
        equality constraints: int
        upper bounds: Object)
    method List.<T#2>toArray(T#2[]) is not applicable
      (inference variable T#2 has incompatible bounds
        equality constraints: int
        upper bounds: Object)
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in method <T#1>toArray(T#1[])
    T#2 extends Object declared in method <T#2>toArray(T#2[])
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
stdout
Standard output is empty