This site requires JavaScript, please enable it in your browser!
Greenfoot back
[][][][][]
[][][][][] wrote ...

2014/1/16

Error problem

[][][][][] [][][][][]

2014/1/16

#
           Wall W = (Wall)getOneIntersectingObject(Wall.class);

            if(W!=null){
                  java.awt.Color theColor = W.getMyColor();
                java.util.List<Wall>Z = getWorld().getObjects(Wall.class);
              
                for(Wall A:Z){
                    if(A.getMyColor().equals(theColor)){
                        A.show();
                    }
                }

            }

        }
java.lang.ClassCastException: java.util.ArrayList cannot be cast to Wall at Main.act(Main.java:30) at greenfoot.core.Simulation.actActor(Simulation.java:568) at greenfoot.core.Simulation.runOneLoop(Simulation.java:526) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205) java.lang.NullPointerException at Main.act(Main.java:38) at greenfoot.core.Simulation.actActor(Simulation.java:568) at greenfoot.core.Simulation.runOneLoop(Simulation.java:526) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205) this is the error ^^^ help if you can thank you. :D
You need to login to post a reply.