title: How to convert object array to string array in Java
body: <p>I use the following code to convert an Object array to a String array :</p>
  
  <pre><code>Object Object_Array[]=new Object[100];
  // ... get values in the Object_Array
  
  String String_Array[]=new String[Object_Array.length];
  
  for (int i=0;i&lt;String_Array.length;i++) String_Array[i]=Object_Array[i].toString();
  </code></pre>
  
  <p>But I wonder if there is another way to do this, something like :</p>
  
  <pre><code>String_Array=(String[])Object_Array;
  </code></pre>
  
  <p>But this would cause a runtime error: <code>Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;</code></p>
  
  <p>What's the correct way to do it ? </p>