/* package whatever; // don't place package name! */ import java.util.*;import java.lang.*;import java.io.*; /* Name of the class has to be "Main" only if the class is public. */class Ideone{ public static void main (String[] args) throws java.lang.Exception { List l = new ArrayList(); l.add(1); l.add("hallo"); Object m = Collections.max(l); }}
Standard input is empty
Standard output is empty
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String at java.lang.String.compareTo(String.java:111) at java.util.Collections.max(Collections.java:673) at Ideone.main(Main.java:15)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!