Is the left-to-right order of operations guaranteed in Java?

后端 未结 10 1353
温柔的废话
温柔的废话 2021-01-04 10:16

Consider this function:

public static final int F(int a, int b) {
    a = a - 1 + b;
    // and some stuff
    return a;
}

Is it required

10条回答
  •  梦毁少年i
    2021-01-04 11:00

    Important to add here is that java does have in line precedence for operators which appears to be based on the basic arithmetic order of operations. For a list of full precedence look at this source

提交回复
热议问题