public class Test1 {
public static void main(String[]args){
int medal_all=800; //member variable
public void china(){
int medal_china=100; //local variable for the method
if(true){ //code block
int gold=50; //local variable for the code block
medal_china+=50; //to be allowed access
medal_all-=150; //to be allowed access
}
gold=100; //compile errors
medal_china+=100;//to be allowed access
medal_all-=200; //to be allowed access
public void(){
medal_all=800;//to be allowed access
medal_china=100;//compile errors,it can't allow to local variable of other method
gold=10; //compile errors
}
}
}
}