package Test;
public class demo{
public static void main(String[]args) {
Emp emp = new Emp("浪哥",17,3000.6);
emp.getInfo();
}
}
class Emp{//定义个类
private String ename;//定雇员名称
private int eage;//定义雇员年龄
private double eprice;//定义雇员工资
public Emp() {}
public Emp(String n, int a, double p) {
ename = n;
eage = a;
eprice = p;
}
public void setEname(String n) {
ename = n;
}
public void setEage(int a){
eage = a;
}
public void setEprice(double p) {
eprice = p;
}
public String getEname() {
return ename;
}
public int getEage() {
return eage;
}
public double getEprice() {
return eprice;
}
public void getInfo() {
System.out.println("姓名:"+ ename + "\n年龄:"+ eage + "\n工资:"+ eprice);
}
}
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!