码迷,mamicode.com
首页 > 编程语言 > 详细

java之Employee

时间:2018-05-27 17:38:17      阅读:676      评论:0      收藏:0      [点我收藏+]

标签: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();
}
}

java之Employee

标签:name   main   out   imp   年龄   sys   oid   ack   高级程序员   

原文地址:https://www.cnblogs.com/choco1986/p/9096641.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!