Sorry in english, but i have 2.U mean this?class A{
String instanceStr;
public void a(){
String localStr;
}
}The instanceStr, as a field member of the instance of A, will exist as long as the instance does, while the local variable, named localStr in method a() will be different. Each time this method is invoked, there will be a new variable named localStr, and this new one will be no longer used when the method returns.
As for their names _s or s, they don't have any thing to do with their difference. You can name them anything you like so long as they're legal.
String instanceStr;
public void a(){
String localStr;
}
}The instanceStr, as a field member of the instance of A, will exist as long as the instance does, while the local variable, named localStr in method a() will be different. Each time this method is invoked, there will be a new variable named localStr, and this new one will be no longer used when the method returns.
As for their names _s or s, they don't have any thing to do with their difference. You can name them anything you like so long as they're legal.
这不是一回事吗
_s是C++的习惯变量命名方法
JAVA一般是小写加大写