Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method parameters order in Java [duplicate]

Possible Duplicate:
Order of execution of parameters guarantees in Java?

If I have a Java method like:

    public void func(byte b, byte c) {...}

And I use it like this:

    a = 0;
    func(a++, a);

Wich parameter is passed first? Because if i'm not wrong, if it's the left one then b = 0 and c = 1. And if it's the right one then b = 0 and c = 0?

Thank you.

like image 675
0x77D Avatar asked Feb 14 '12 23:02

0x77D


1 Answers

The arguments are evaluated left to right, as specified in the JLS - section 15.7.4.

like image 160
MByD Avatar answered Sep 28 '22 00:09

MByD