method同じ内の別の変数を呼び出す方法はclass?
public void example(){    
    String x='name';
}
public void take(){
    /*how to call x variable*/
}
method同じ内の別の変数を呼び出す方法はclass?
public void example(){    
    String x='name';
}
public void take(){
    /*how to call x variable*/
}
クラスのインスタンス変数にします。
public class MyClass
{
    String x;
    public void example(){ x = "name"; } // note the double quotes
    public void take(){ System.out.println( x ); }
}
public class Test
{
static String x;
public static void method1
{
x="name";
}
public static void method2
{
System.out.println(+x);
}
}