Answer:
//The Employee Class
public class Employee {
char name;
long ID;
//The constructor
public Employee(char name, long ID) {
this.name = name;
this.ID = ID;
}
//Method Get Person
public void getPerson (char newName, long newId){
this.ID = newName;
this.ID = newId;
}
//Method Print
public void print(){
System.out.println("The class attributes are: EmpName "+name+" EmpId "+ID);
}
}
The working of the class is shown below in another class EmployeeTest
Explanation:
public class EmployeeTest {
public static void main(String[] args) {
Employee employee1 = new Employee('a', 121);
Employee employee2 = new Employee('b', 122);
Employee employee3 = new Employee('c', 123);
employee1.print();
employee2.print();
employee3.print();
}
}
In the EmployeeTest class, Three objects of the Employee class are created.
The method print() is then called on each instance of the class.