/* 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 { Object[] objectArr= {"Hello", new Integer(10), new Object()}; String[] stringArray = Arrays.asList(objectArr).toArray(new String[0]); }}
Standard input is empty
Standard output is empty
Exception in thread "main" java.lang.ArrayStoreException at java.lang.System.arraycopy(Native Method) at java.util.Arrays.copyOf(Arrays.java:3213) at java.util.Arrays$ArrayList.toArray(Arrays.java:3831) at Ideone.main(Main.java:13)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!