Based on the few rules mentioned above we can define a POJO class as follows:
publicclassEmployee{
privateint id; privateString firstName; privateString lastName; privateint salary; publicEmployee(){} publicEmployee(String fname,String lname,int salary){ this.firstName = fname; this.lastName = lname; this.salary = salary; } publicint getId(){ return id; } publicvoid setId(int id ){ this.id = id; } publicString getFirstName(){ return firstName; } publicvoid setFirstName(String first_name ){ this.firstName = first_name; } publicString getLastName(){ return lastName; } publicvoid setLastName(String last_name ){ this.lastName = last_name; } publicint getSalary(){ return salary; } publicvoid setSalary(int salary ){ this.salary = salary; } } |