java - error: cannot assign a value to final variable (int) -
ok i'm sure simple, i'm having issues , mind blank. =( know 'final' makes variable can't change that's pretty can figure out right now. , code...
if take out 'final' error comes "error: missing return statement }" first 2 methods.
edit: thank help, surprising how fast got help! took out 'final' , added 'void' first 2 methods. i'm sure it'll take time understand everything, helps.
there part 2 , here part have no clue on do... second part have test first program. supposed make separate file same code? if can great, if not thats fine i'll work on later.
you declare function
public static int removeonefromroom (int number) { totalnumber = totalnumber-number; }
the emphasis here public static int, telling compiler function supposed return integer. not return in function body, compiler complains rightfully. either return something, or declare return value void.
Comments
Post a Comment