Missing Return Statement Error
Hi All
I have problem with below method - I understand it means that Sting is not being retuned - but I don't understand why cause I clearly stated in code that string should be returned. Please help:
Code:
/**
* If the argument is between 1 and 3 inclusive,
* sets the value of its playingMode instance variable to the value of the int argument,
* otherwise returns the string: "Playing mode unchanged".
*/
public String selectProgram(int aValue)
{
if (aValue >= 1 && aValue <= 3)
{
this.setPlayingMode(aValue);
if (this.getPlayingMode() == 1)
{
return "Repeat off";
}
if (this.getPlayingMode() == 2)
{
return "Repeat track";
}
if (this.getPlayingMode() == 3)
{
return "Repeat all";
}
}
else
{
return "Playing mode unchanged";
}
} ---- ERROR IS HERE -- It highlights this bracket.