Untitled

 avatar
unknown
java
a year ago
779 B
4
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