How to change value by reference?
Here is an example code:
Code:
package test;
public class Test {
static boolean test (String someString) {
boolean anotherBool = true;
someString = "IWantThisString";
return anotherBool;
}
public static void main(String[] args) {
String someString = "NotThisString";
boolean someBool = false;
someBool = test(someString);
System.out.println(someBool + " " + someString);
//It prints the following:
//true NotThisString
}
}
how can i get someString to become "IWantThisString" and print that out?
Im trying to get it work for another project
Restrictions are that I use that boolean function.