How do I make parameter settings in Java?

Given the following function call in C :

 fooFunc( barFunc(), bazFunc() ); 

The execution order of barFunc and BazFunc not specified, so barFunc() can be called before bazFunc() or bazFunc() before barFunc() in C

Does Java indicate the execution order of the argument expressions of the function, or how does C not indicate this?

+52
java order-of-evaluation jls specifications
Feb 04 '10 at 17:16
source share
1 answer

From the Java Language Specification (in expressions):

15.7.4. Argument lists are evaluated left-right

In a method or constructor call, or an instance of creating an instance of a class, argument expressions can appear inside parentheses, separated by commas. It seems that every argument expression is fully evaluated before any part of any argument on the right.

+56
Feb 04 '10 at 17:20
source share



All Articles