How to get value of an object and store it in variable int? In string I do this:
String k = s_extend.getValue().toString();
How about in int?
You can use Integer.valueOf() or Integer.parseInt(); unless there's more to your question that would be something like this -
public static void main(String[] args) {
String str = "1";
int a = Integer.valueOf(str); // java.lang.Integer return(ed)
int b = Integer.parseInt(str); // primitive (int) return(ed)
System.out.printf("a = %d, b = %d\n", a, b);
}
On my machine, running this gives
a = 1, b = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With