标签:turn string this color getname int sub his oid
public class Teacher { String name; String subject; int age; Teacher(String n,String s){ name=n; subject=s; } public void setName(String name){ this.name=name; } public String getName(){ return this.name; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public void showInfo(){ System.out.println("name: "+name+" subject:"+subject); } }
public class Test{ public static void main(String[] args) { Teacher t=new Teacher("胡丽丽", "语文"); t.setName("李浩"); t.showInfo(); System.out.println(t.getName()); } }
标签:turn string this color getname int sub his oid
原文地址:http://www.cnblogs.com/zyy1130/p/6687501.html