Simple Java calculator

后端 未结 10 1912
迷失自我
迷失自我 2020-12-22 02:16

Firstly this is not a homework question. I am practicing my knowledge on java. I figured a good way to do this is to write a simple program without help. Unfortunately, my c

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-22 02:55

    Another issue is, the line

    y = operands.next();
    

    is attempting to place a String returned from Scanner.next() into the a variable y which is declared as a type int.

    The Scanner.nextInt() method can be used to attempt to return an int.

提交回复
热议问题