java.lang.String cannot be cast to [Ljava.lang.Object while Iterating For Loop
<p>I am getting a <code>classcast</code> exception while i am iterating my for loop.</p>

<p>This is my code:</p>

<pre><code>List&lt;Object[]&gt; objList = myDao.getList(bookId, bookName);
for(Object[] t : objList )
{       
    if(!myClass.isBlank((String)t[1]))
    {
        bookList.add(new book((String) t[0],(String) t[0]));
    }
}
</code></pre>

<p>Below is the output i get in my <code>objList</code></p>

<pre><code>[Potter, GOT]
</code></pre>

<p>Exception while entering for Loop</p>

<blockquote>
  <p>java.lang.String cannot be cast to [Ljava.lang.Object</p>
</blockquote>

<p>What i tried again was to change my for loop as below but it still didnt worked.</p>

<pre><code>List&lt;Object[]&gt; objList = myManager.getList(bookId, bookName);
String[] bookObj = new String[objList.size()];
for (int i = 0; i &lt; objList.size(); i++) {

    if(!myClass.isBlank((String)bookObj[i])){
        bookList.add(new SelectItem((String) bookObj[i],(String) bookObj[i]));
    }
}
</code></pre>

<p>Can anyone please guide whats wrong.</p>