title: Object[] cannot not be converted to String[] in jsp
body: <pre><code>&lt;%
      ArrayList aList=(ArrayList)request.getAttribute("read");
      String[] write =aList.toArray(new String[aList.size()]);
  %&gt;
  </code></pre>
  
  <p>in above code, i am getting </p>
  
  <blockquote>
    <p>incompatible types: Object[] cannot be converted to String[].</p>
  </blockquote>
  
  <p>if i cast only i will get the answer what i wish, i <a href="https://www.google.co.in/search?q=convert%20arraylist%20to%20string%20in%20foreach%20&amp;oq=convert%20arraylist%20to%20string%20in%20foreach%20&amp;aqs=chrome..69i57.17950j0j7&amp;sourceid=chrome&amp;espv=2&amp;es_sm=91&amp;ie=UTF-8#q=to%20convert%20arraylist%20to%20array%20in%20java" rel="nofollow">google</a> and got lot of solution, but nothing gave me a solution, help me to find out of this problem. thanks in advance for your replies.</p>