What is wrong with this code if ( canSee(Fly.class) ) that it gives me some message "cannot find symbol-method canSee (java.lang. Class<Fly>) .


1 2 3 4 5 6 7 8 9 10 11 | public void eat() { Actor food; food = getOneObjectAtOffset( 0 , 0 , food. class ); if (food != null ) { World world; world = getWorld(); world.removeObject(food); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class me here. * * @author (your name) * @version (a version number or a date) */ public class me extends Actor { public void act() { lookforsmting(); if (thing != null ) { eat(); } } public void lookforsmting() { Actor thing; thing = getOneObjectAtOffset( 0 , 0 , thing. class ); } public void eat() { World world; world = getWorld(); world.removeObject(thing); } } |
1 | return thing; |
1 | Actor thing = lookforsmting(); |
1 | eat(thing); |
1 | public void eat(Actor thing) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import greenfoot.* public class Me extends Actor // it is customary to begin class names with capital letters { public void act() { eat(); } public void eat() { Actor thing = getOneIntersectingObject(Thing. class ); if (thing != null ) getWorld().removeObject(thing); } } |