Java - Order of Operations - Using Two Assignment Operators in a Single Line

前端 未结 4 459
Happy的楠姐
Happy的楠姐 2020-12-01 23:43

What are the order of operations when using two assignment operators in a single line?

public static void main(String[] args){
    int i = 0;
    int[] a = {         


        
4条回答
  •  孤城傲影
    2020-12-02 00:40

    If I remember correctly, = operator is right-associative; so i will be assigned first, then a[i].

提交回复
热议问题