public void mRun(final String name) {
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(name);
}
}).start();
}
final FinalEntity entity = new FinalEntity("王俊", 23, new Student());
lg.e(entity.toString());
entity.str = "新的任务";
entity.stu = new Student();
entity.intValue = 100;
lg.e(entity.toString());
entity=new FinalEntity("新的Str",99,new Student());//编译错误
public class FinalEntity {
public String str;
public Integer intValue;
public Student stu;
public FinalEntity(String str, Integer intValue, Student stu) {
this.str = str;
this.intValue = intValue;
this.stu = stu;
}
@Override
public String toString() {
return super.toString() + "***" + str + "***" + intValue + "***" + stu.toString();
}
}
原文:http://www.cnblogs.com/linux007/p/5777982.html