Incrementor logic

后端 未结 7 2171
醉梦人生
醉梦人生 2020-11-27 05:37

I\'m trying to get deeper with post and pre incrementors but am a bit stuck with the following expression :

public static void main(String[] args) {
    int i         


        
7条回答
  •  余生分开走
    2020-11-27 05:49

    Paranthesis takes the precedence. order would be from inner most to outermost

    (i+=2 + --i) =>i=i+=2==(2) --2 =0 
    (++i - ++i)  =>1-1=0 
    i=i+ =0+0 =0
    

    Each expression evaluates to 0

提交回复
热议问题