Untitled
unknown
java
2 years ago
779 B
5
Indexable
public class Person {
private int number;
private String name;
private String education;
// Constructor with parameters for initializing fields
public Person(int number, String name, String education) {
this.number = number;
this.name = name;
this.education = education;
}
// Accessor methods for fields
public int getNumber() {
return number;
}
public String getName() {
return name;
}
public String getEducation() {
return education;
}
// toString() method for printing employee information
@Override
public String toString() {
return "Employee Number: " + number + ", Name: " + name + ", Education: " + education;
}
}Editor is loading...
Leave a Comment