fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4.  
  5. /* The class name doesn't have to be Main, as long as the class is not public. */
  6. class Main
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. List<Integer> list = new ArrayList<Integer>();
  11. list.add("hello");
  12. }
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
2
10
42
11
compilation info
Main.java:11: error: no suitable method found for add(String)
     list.add("hello");
         ^
    method List.add(int,Integer) is not applicable
      (actual and formal argument lists differ in length)
    method List.add(Integer) is not applicable
      (actual argument String cannot be converted to Integer by method invocation conversion)
1 error
stdout
Standard output is empty