When is an unassigned expression a valid statement?

前端 未结 4 756
一生所求
一生所求 2020-12-20 11:23

I\'ve read Oracle\'s expressions tutorial and couldn\'t understand this.

It is well known that the following line of code is valid Java syntax:

new O         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-20 11:39

    Creating an object or calling or method can have side effects, I think this is the main reason for this, whereas nothing will ever happen with an arithmetic expression.

提交回复
热议问题