public class teacher //声明教师类
{
public String id; //成员变量
public String name;
public String specialty;
public teacher(String id, String name, String specialty){
this.id = id;
this.name = name;
this.specialty = specialty;
}
public void showset(){
System.out.println("教师编号"+id +", 姓名"+name+ ", 专业"+specialty);
}
public static void main(String[] args) {
teacher t1=new teacher("1","张三","计算机");//声明对象并赋值
teacher t2=new teacher("111","李四","材料");
t1.showset();//调用成员方法
t2.showset();
}
}



