标签:name main out imp 年龄 sys oid ack 高级程序员
package learning;
import java.util.*;
import java.io.*;
public class Employee{
String name;
int age;
String designation;
double salary;
public Employee(String name) {
this.name = name;
}
public void empAge(int empAge) {
age = empAge;
}
public void empDesignation(String empDesig) {
designation = empDesig;
}
public void empSalary(double empSalary) {
salary = empSalary;
}
public void printEmployee() {
System.out.println("名字:"+ name);
System.out.println("年龄:"+ age);
System.out.println("职位:"+ designation);
System.out.println("薪水:"+ salary);
}
}
public class EmployeeTest {
public static void main(String args[]){
Employee empOne = new Employee("RUNOOB1");
Employee empTwo = new Employee("RUNOOB2");
empOne.empAge(26);
empOne.empDesignation("高级程序员");
empOne.empSalary(1000);
empOne.printEmployee();
empTwo.empAge(21);
empTwo.empDesignation("菜鸟程序员");
empTwo.empSalary(500);
empTwo.printEmployee();
}
}
标签:name main out imp 年龄 sys oid ack 高级程序员
原文地址:https://www.cnblogs.com/choco1986/p/9096641.html