/* 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 { ArrayList list = new ArrayList();for(int i =0;i<10;i++)list.add(""+i);String s = list.get(2);System.out.println(s); }}
Standard input is empty
Main.java:15: error: incompatible types: Object cannot be converted to String String s = list.get(2); ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!