Type casting problem with java for-each loop
Posted
by pharma_joe
on Stack Overflow
See other posts from Stack Overflow
or by pharma_joe
Published on 2010-05-20T09:56:40Z
Indexed on
2010/05/20
10:00 UTC
Read the original article
Hit count: 167
Hi,
I have traced an issue with an application I am developing, it is giving me a type cast exception. Funny thing is it is saying it cannot cast "entities.Movie cannot be cast to entities.Movie"?! movies is an ArrayList.
try {
movies = getMovies();
} catch (Exception e) {
e.printStackTrace(System.out);
} finally {
try {
for (Movie movie : movies) {
output.append(" <tr>\n");
output.append(" <td>" + movie.getId() + "</td>");
output.append(" </tr>\n");
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
© Stack Overflow or respective owner