Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Author {
- // private instance variable, not accessible from outside this class
- private String Name;
- private String Email;
- private char Gender;
- // Constructor to construct a new instance of Author with the given Name,
- // Email and Gender
- public Author(String Name, String Email, char Gender) {
- this.Name = Name;
- this.Email = Email;
- this.Gender = Gender;
- }
- // A public method for retrieving the Name, Email and Gender
- public String getName() {
- return Name;
- }
- public String getEmail() {
- return Email;
- }
- public char getGender() {
- return Gender;
- }
- // Setter for instance variable Email
- public void setEmail(String Email) {
- this.Email = Email;
- }
- public String toString() {
- return Name + "(" + Gender + ")" + " at " + Email;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement