Android pass object not its value

How can I update String object from void? Now it gives me an error: The final local variable sObj cannot be assigned, since it is defined in an enclosing type.

String object = "";
String object2 = "";
String object3 = "";
String object4 = "";
String object5 = "";

digitInput(object); //update string object
digitInput(object4); // update string object4


private void digitInput(final String sObj) {
      ....
      sObj = NEW_VALUE; //With this I want to update passed object
      ....
}

Answers


It seems like you are trying to reassign the value of the object using the function. The approach you are taking is strange. I would do it like:

String object = "";
String object2 = "";
String object3 = "";
String object4 = "";
String object5 = "";

object = digitInput(object); //update string object
object4 = digitInput(object4); // update string object4

// assuming you need the original object to generate the new value
private String digitInput(String sObj) {
      ....
      // do something
      ....
      return NEW_VALUE; //With this I want to update passed object
}    

You want to set the value of object to the value of sObj? this.object = sObj;


Remove the final qualifier from the method signature.


Need Your Help

ip address search algorithm or library in C

c++ c linux network-programming ip

I have a network application that is making ip_address based firewalling. I find the source ip of the client in my application and then, if the ip of the client is in the subnet of the ips in my

Cannot convert []string to []interface {}

type-conversion go

I'm writing some code, and I need it to catch the arguments and pass them through fmt.Println