Can I return or change the value of a string variable when called from Java? I know that a method can return a value, but if I want to have some values changed, can I use a pointer or something?
For example, if I would be writing a method to extract the first characters of a String, and leave the original string without those values, could I do something like:
public static String popFirstChars(String text, int amount) {
String extract = text.substring(0, amount);
String remaining = text.substring(amount +1, text.length());
// this is what I don't know if it's possible:
text = remaining;
// this is the standard return
return extract;
}