import java.util.Scanner;
public class ZamaCodes
{
public static void main(String[] args)
{
Employee E=new Employee();
Employee Earr[]=new Employee[5];
System.out.println(E.getAge());
for(int k=0;k<5;k++)
{
Earr[k]=new Employee();
}
Earr[0].setAge(10);
Earr[1].setAge(20);
System.out.println(Earr[0].getAge());
System.out.println(Earr[1].getAge());
}
}
public class Employee {
private String name;
private int age;
private float salary;
public Employee()
{
name=null;
age=0;
salary=0;
}
public Employee(String name,int age,float Salary)
{
this.name=name;
this.age=age;
this.salary=Salary;
}
//**********************setters*************************//
public void setAge(int age) {
this.age = age;
}
public void setName(String name) {
this.name = name;
}
public void setSalary(float salary) {
this.salary = salary;
}
//**********************Getters*************************//
public String getName() {
return name;
}
public int getAge() {
return this.age;
}
public float getSalary() {
return salary;
}
public void aging()
{
this.age=this.age+1;
}
}
0 comments:
Post a Comment