Blogger Information
Blog 5
fans 0
comment 0
visits 3676
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
简单Java类
Java攻城狮的Blog
Original
991 people have browsed it
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!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post