New to Greenfoot/Java coding. I keep getting this error message "class, interface or enum expected" - it highlights this code (public void checkKeypress ()
Here is my code:
import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot)
/**
* Act - do whatever the crab wants to do.
* /
public void act()
{
checkKeypress();
move ();
lookForWorm ();
}
/**
* Check whether a control key on the keyboard has been pressed.
* If it has, react accordingly.
*/
public void checkKeypress()
{
if (Greenfoot.isKeyDown("left"))
{
turn (-4);
}
if (Greenfoot.isKeyDown ("right"))
{
turn (4);
}
}

