该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
{
String schoolname;
String schoolgrade;
String teachername;
String teachercode;
String teachercexy;
String teachercourse;
String teachersalary; // 教师变量
public void set(String teachername,String teachercode,String teachercexy,String course)
{
this.teachername=teachername;
this.teachercode=teachercode;
this.teachercexy=teachercexy;
this.teachercourse=teachercourse;
}
public void set(String schoolname,String schoolgrade) //覆盖学校接口方法
{
this.schoolname=schoolname;
this.schoolgrade=schoolgrade;
}
public String getschoolname() //覆盖学校接口方法
{
return schoolname;
}
public String getschoolgrade() //覆盖学校接口方法
{
return schoolgrade;
}
public void run() //覆盖runnable线程接口方法
{
int[] teachersalary=new int[13];
for(int i=1;i
{
teachersalary[i]=2000+i*300;
System.out.println("这个老师的薪水是:"+teachersalary[i]);
}
}
}
//主运行类
public class school1
{
public static void main(String[] args)
{
teacher t=new teacher(); //创建老师类对象
student st=new student(); //创建学生类对象
t.set("董洁","22334","女","英语");
st.set("张俊","01","男","计算机");
Thread st1=new Thread(st); //创建学生对象线程
Thread t1=new Thread(t); //创建教师对象线程
st1.start(); //学生对象线程开始
t1.start(); //教师对象线程开始
}
}