Hey Guys, something different form your discussion. Can someone help me here?I have this:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MyDog here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MyDog extends Dog
{
private String image = "dog.png";
private int energy = 100;
private boolean amSleepy = false;
private int countSteps;
/**
* Act - do whatever the MyDog wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
//All code relating to the player-controlled dog goes here
walkMyDog();
}
}
/**
* This dog gets sleepy when its energy hits 20 or lower.
*/
public boolean isSleepy(){
if ( energy <= 20 )
{
amSleepy = true;
}
else
{
amSleepy = false;
}
return amSleepy;
}
Now every time I try to compile this, I have this error displayed: class, interface, or enum expected with emphasis in the source code highlighting this whole method in yellow: ' public boolean isSleepy() ' , also marking a redline before |boolean. What am I doing wrong, please tell me?
Recent Comments
2013/1/28
Text Editor