Passing params in java by reference -


i'm new comer form c#, , know "java pass-by-value."

but pass-by-reference useful when want multiple outputs 1 method.

how can multiple outputs 1 method in java, in c#.

i know 1 way -- use generic wrapper class, , value field.

class wrapper<t> {     public wrapper(t value) {         value = value;     }     public t value; } 

is there way realize effect?

no, java not have out parameters. can pass object reference method modify pretend has out parameters, isn't best design , runs other issues (multithreading , mutable state one).

the best way achieve method returns multiple values have method return type contains multiple values.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -