Syntax error, insert “VariableDeclarators” to complete LocalVariableDeclaration occurs

To make the Syntax error disappear and to assign a value to distanceTraveledmodify the method public Water update(int time) as follows:

public Water update(int time) {
    distanceTraveled = 1; // assign a value before returning
    return Water.this;

Maybe you should read a bit about Java and doing some tutorials, because this is very basic stuff (at least if I’m not getting you wrong).

Leave a Comment