Java level calculator if statement returning the wrong value (Newbie)

后端 未结 6 1458
野的像风
野的像风 2021-01-21 09:48

i\'m learning some Java and decided to do something simple but it keeps returning the wrong value... i don\'t know why i\'m sure there something that my untrained eye isn\'t pic

6条回答
  •  春和景丽
    2021-01-21 10:03

     if (userxp >=level1xp || userxp 

    That should be && not || .

    And my minimal suggestion would be to completely drop the first condition.

    Since you are in the else branch, you have already checked that the XP is not lower than the previous level requirement.

     if (userxp 

提交回复
热议问题