Why doesn't Integer.parseInt(“1”)++ work in Java?

后端 未结 5 557
渐次进展
渐次进展 2020-12-30 00:26

I\'ve got the following line of code:

suffix = suffix.isEmpty() ? \"1\" : Integer.toString(Integer.parseInt(suffix)+1);

in a block where su

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 01:15

    The int is an rvalue. Since it isn't bound to a variable you cannot use post-incrementation.

提交回复
热议问题