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

2013/1/14

Where is my mistake?

Enes Enes

2013/1/14

#
Here is my code:
public boolean fliegeKlatschen() 
{
    if(!geklatscht) {
             Actor fliege = getOneObjectAtOffset(0,0,Spinne.class);
    if(fliege != null) {
            fliegen++;
            punkte++;
    
            }

    else {
        if(nachrichten) {
         JOptionPane.showMessageDialog(null,"Auf dem Platz liegt keine  Fliege.","Fehler",JOptionPane.ERROR_MESSAGE);  
        }
    }
}
}
(its german) He say to the last sign: "missing return statement" Can anybody help me? Thanks!
erdelf erdelf

2013/1/14

#
change the method type in void
Enes Enes

2013/1/14

#
thanks, but why is boolean wrong?
Dytanoth Dytanoth

2013/1/14

#
public boolean fliegeKlatschen() The boolean tells the system to return a boolean, but you don't have a return statement in your code. If you use: public void fliegeKlatschen(), the system will know there won't be a return statement.
You need to login to post a reply.