2008年10月1日
public class ToStringDemo {
String name;
int age;
public ToStringDemo(String name,int age){
this.name = name;
this.age = age;
}
public String toString(){
return "名字是:"+name+","+"年龄是:"+age;
}
public static void main(String[] args){
ToStringDemo p = new ToStringDemo("smile",34);
System.out.println(p);
}
}
posted @
2008-10-01 16:44 小悟 阅读(282) |
评论 (5) |
编辑 收藏