casting parent to child - BufferedImage object

Viewed 24322

I'm get a ClassCastException whenever I try to cast a BufferedImage (parent) to an AdvancedBufferedImage (child) which I extended myself, I've not overridden any methods and I've implemented all the contractors without modifying them

I'm gettign this exception whenever I try to create an AdvancedBufferedImage out of File using ImageIO.read() method.

File file = new file(path);
AdvancedBufferedImage image = (AdvancedBufferedImage) ImageIO.read(file);

It seems there should not be any problem, What could be the problem?

7 Answers
Related