How to call a variable in another method in the same class?
method
class
public void example(){ String x=\'name\'; } public void take()
You make it an instance variable of the class:
public class MyClass { String x; public void example(){ x = "name"; } // note the double quotes public void take(){ System.out.println( x ); } }