How to call a variable in another method in the same class?
method
class
public void example(){ String x=\'name\'; } public void take()
Since they are in different scopes you can't.
One way to get around this is to make x a member variable like so:
String x; public void example(){ this.x = "name"; } public void take(){ // Do stuff to this.x }