Hello,
I'm new to this, but I am doing Programming, as one of my papers for uni
And also, I am new to Java and Programming
But after I compile it, it says 'unreachable statement'
String generateStatusR eport(Robot karel) {
For the return statements, it still works with or without the brackets ( )
But I get an error message, especially on the second and third if statement
I don't know why I get an error message saying 'unreachable statement'
I can't see what the problem/mistake is, that I can see
NB: Numbers 1-14 is all code
I'm new to this, but I am doing Programming, as one of my papers for uni
And also, I am new to Java and Programming
But after I compile it, it says 'unreachable statement'
String generateStatusR eport(Robot karel) {
Code:
if(isRobotDead(karel))
return"The robot is dead."
else
return"The robot is alive.";
if(isRobotFacingWall(karel)) //unreachable statement
return"The robot is facing a wall.";
else
return"The robot is not facing a wall.";
if(isItemOnGroundAtRobot(karel)) //unreachable statement
return"There is an item here.";
else
return"There is no item here.";
For the return statements, it still works with or without the brackets ( )
But I get an error message, especially on the second and third if statement
I don't know why I get an error message saying 'unreachable statement'
I can't see what the problem/mistake is, that I can see
NB: Numbers 1-14 is all code
Comment