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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -