title: class cast exception: java.lang.String incompatible with [Ljava.lang.Object;
body: <p>What is wrong with below code ?</p>
  
  <pre><code>List&lt;Object[]&gt; currencies = null;
  List&lt;String&gt; currencyList = new ArrayList&lt;String&gt;();
  
  //code to fetch currency
  String currencySql = "select C.Currency from Currency C";
  Query currencyQuery = this.em.createQuery(currencySql);
  
  currencies = currencyQuery.getResultList();
  
  for (Object[] currency : currencies) {    //getting runtime error here
     for (int i = 0; i &lt; currency.length; i++) {
              currencyList.add(currency[i].toString());
          }
      }
  </code></pre>
  
  <p>Getting runtime error in first line of for loop as: 
      java.lang.ClassCastException: java.lang.String incompatible with [Ljava.lang.Object;</p>
  
  <p>The code compiles alright.</p>
  
  <p>What is the issue ?</p>