vb.net - What is the equivalent to "ByRef" in Java? -
this question has answer here:
i'm working on translating code visualbasic java , i've encountered snag when using byref keyword in vb. doesn't exist in java!
how should simulate byref call in java?
edit: clarify don't know vb, byref identifies variable in parenthesis after calling function , makes when variable changes inside of function, change higher called opposed byval value of variable remembered. changing byval variable in method not affect variable called.
you can't. in java passed value, including object references. create "holder" object, , modify value inside method.
public class holder<t> { t value; public holder(t value) { this.value = value; } // getter/setter } public void method(holder<foo> foo) { foo.setvalue(something); }
Comments
Post a Comment