public class TestThis {
private String name;
void eat(String name){
//String food;//局部变量在使用时必须初始化,否则会报错 error
String food = "apple"; //right
System.out.println(this.name+"邀请"+name+"吃"+food);
}
}
原文地址:http://www.cnblogs.com/siashan/p/3847901.html