public class Test1 {
public static void main(String[]args){
int medalall=800; //member variable
public void china(){
int medalchina=100; //local variable for the method
if(true){ //code block
int gold=50; //local variable for the code block
medalchina+=50; //to be allowed access
medalall-=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
}
}
}
}
main方法里面怎么还包含一个方法?
方法里面包方法这是什么规则