compareTo Error: Cannot invoke compareTo(int) on the primitive type int

前端 未结 2 1752
广开言路
广开言路 2021-01-27 01:56

Not sure how to get the compareTo to not give error.

Very lost. Tried changing multiples lines of code.

public voide addValue(int newNumber)         


        
2条回答
  •  深忆病人
    2021-01-27 02:37

    Edit: I can't believe what I originally wrote here.

    Can you not just use a relational comparison operator here?

    (firstNum < secondNum) // This will return a boolean value of true or false.
    

提交回复
热议问题