Error “this method must return a result of type int”?

后端 未结 6 2079
攒了一身酷
攒了一身酷 2021-01-28 03:06

I have this code below and it keep telling me that thanksgiving() must return a result type of int. I have casted all the results just to make sure, but nothing seems to be work

6条回答
  •  爱一瞬间的悲伤
    2021-01-28 03:34

    You have 3 if statements inside thanksgiving() method. What if none of the condition gets satisified? What would return in that case? So compiler is complaining.

提交回复
热议问题