File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

the instance variable shapes

 
mike hew
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CREATE the instance variable shapes, an array of Shape objects, with myFile.getCountOfRecords() elements

which I try'd: Shape[] shape = shapes;
but I get the error:


Exception in thread "main" java.lang.ClassCastException: Circle
at ShapeTest.loadShapesArray(ShapeTest.java:121)
at ShapeTest.main(ShapeTest.java:24)

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this line:

shape[index] = (Shape) new Circle(Integer.parseInt(myFields[c_xCoordinateField]),

you are casting a Circle to a Shape. You get the error because class Circle is not a subclass of class Shape.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic