Advertisement
Guest User

Author

a guest
Apr 16th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. public class Author {
  2.     // private instance variable, not accessible from outside this class
  3.     private String Name;
  4.     private String Email;
  5.     private char Gender;
  6.  
  7.     // Constructor to construct a new instance of Author with the given Name,
  8.     // Email and Gender
  9.     public Author(String Name, String Email, char Gender) {
  10.         this.Name = Name;
  11.         this.Email = Email;
  12.         this.Gender = Gender;
  13.     }
  14.  
  15.     // A public method for retrieving the Name, Email and Gender
  16.     public String getName() {
  17.         return Name;
  18.     }
  19.  
  20.     public String getEmail() {
  21.         return Email;
  22.     }
  23.  
  24.     public char getGender() {
  25.         return Gender;
  26.     }
  27.  
  28.     // Setter for instance variable Email
  29.     public void setEmail(String Email) {
  30.         this.Email = Email;
  31.     }
  32.    
  33.     public String toString() {
  34.            return Name + "(" + Gender + ")" + " at " + Email;
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement