JavaScript(简称“JS”) 是一种具有函数优先的轻量级,解释型或即时编译型的编程语言。虽然它是作为开发Web页面的脚本语言而出名,但是它也被用到了很多非浏览器环境中,JavaScript 基于原型编程、多范式的动态脚本语言,并且支持面向对象、命令式和声明式(如函数式编程)风格。[1]
public class Employee extends Human {
private String workNo;
private String salary;
private int count;
public Employee(String idCard, String name, String sex, int age, String workNo, String salary, int count) {
super(idCard, name, sex, age);
this.workNo = workNo;
this.salary = salary;
this.count = count;
}
public Employee() {
}
public String getWorkNo() {
return workNo;
}
public void setWorkNo(String workNo) {
this.workNo = workNo;
}
public String getSalary() {
return salary;
}
public void setSalary(String salary) {
this.salary = salary;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
@Override
public String toString() {
return "Employee{" +
"workNo='" + workNo + '\'' +
", salary='" + salary + '\'' +
", count=" + count +
'}';
}
}
public class TestClass {
public static void main(String[] args) {
Employee e1 = new Employee("123","aa","男",11,"01","1000",11);
Employee e2 = new Employee("124","bb","男",12,"A1","2000",16);
System.out.println(e1);
System.out.println(e2);
if(e1.getAge() > e2.getAge()) {
System.out.println(e1);
}else {
System.out.println(e2);
}
System.gc();
System.out.println(e1);
System.out.println(e2);
}
}
具体的方法有些多,需要慢慢写,请稍等