Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Author {
- private String name;
- private String email;
- private char gender;
- public Author(String name, String email, char gender){
- this.name = name;
- this.email = email;
- this.gender = gender;
- }
- public String getName(){
- return name;
- }
- public String getEmail(){
- return email;
- }
- public void setEmail(String em){
- this.email = em;
- }
- public char getGender(){
- return gender;
- }
- public String toString(String check){
- System.out.println (name+"("+check+") at " + email);
- return "0";
- }
- }
- public class TestAuthor {
- public static void main(String[] args) {
- Author author1 = new Author("max", "masik2003_410@mail.ru", 'U');
- author1.getName();
- author1.getEmail();
- char gen = author1.getGender();
- String check;
- if (gen == 'M'){
- check = "m";
- }
- else if (gen == 'M'){
- check = "ms";
- }
- else{
- check = "";
- }
- author1.toString(check);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement