Order of execution of parameters guarantees in Java?

JavaOperator PrecedenceSpecificationsJls

Java Problem Overview


Given the following function call in C:

fooFunc( barFunc(), bazFunc() );

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

Does Java specify an order of execution of function argument expressions or like C is that unspecified?

Java Solutions


Solution 1 - Java

From the Java Language Specification (on Expressions):

> 15.7.4 Argument Lists are Evaluated Left-to-Right > > In a method or constructor invocation > or class instance creation expression, > argument expressions may appear within > the parentheses, separated by commas. > Each argument expression appears to be > fully evaluated before any part of any > argument expression to its right.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiontpdiView Question on Stackoverflow
Solution 1 - JavaMichael EasterView Answer on Stackoverflow