|
| 1 | +package Online_Code_Samples.Week1; |
| 2 | + |
| 3 | +public class Emmanuel { |
| 4 | + private String firstName; |
| 5 | + private String lastName; |
| 6 | + private String fullName; |
| 7 | + private int age; |
| 8 | + private String email; |
| 9 | + private static int count = 0; |
| 10 | + |
| 11 | + public Emmanuel(String firstName, String lastName, int age, String email) { |
| 12 | + this.firstName = firstName; |
| 13 | + this.lastName = lastName; |
| 14 | + this.age = age; |
| 15 | + this.email = email; |
| 16 | + this.fullName = firstName + " " + lastName; |
| 17 | + count++; |
| 18 | + } |
| 19 | + |
| 20 | + public Emmanuel(String firstName, String lastName, String email){ |
| 21 | + this(firstName, lastName, 35, email); |
| 22 | + } |
| 23 | + |
| 24 | + public Emmanuel(String firstName, String lastName){ |
| 25 | + this( firstName, lastName, "[email protected]"); |
| 26 | + } |
| 27 | + |
| 28 | + |
| 29 | + public String getFirstName() { |
| 30 | + return firstName; |
| 31 | + } |
| 32 | + |
| 33 | + public void setFirstName(String firstName) { |
| 34 | + this.firstName = firstName; |
| 35 | + } |
| 36 | + |
| 37 | + public String getLastName() { |
| 38 | + return lastName; |
| 39 | + } |
| 40 | + |
| 41 | + public void setLastName(String lastName) { |
| 42 | + this.lastName = lastName; |
| 43 | + } |
| 44 | + |
| 45 | + public String getFullName() { |
| 46 | + return fullName; |
| 47 | + } |
| 48 | + |
| 49 | + public void setFullName(String fullName) { |
| 50 | + this.fullName = fullName; |
| 51 | + } |
| 52 | + |
| 53 | + public int getAge() { |
| 54 | + return age; |
| 55 | + } |
| 56 | + |
| 57 | + public void setAge(int age) { |
| 58 | + this.age = age; |
| 59 | + } |
| 60 | + |
| 61 | + public String getEmail() { |
| 62 | + return email; |
| 63 | + } |
| 64 | + |
| 65 | + public void setEmail(String email) { |
| 66 | + this.email = email; |
| 67 | + } |
| 68 | + |
| 69 | + public static int getCount() { |
| 70 | + return count; |
| 71 | + } |
| 72 | + |
| 73 | + public static void main(String[] args) { |
| 74 | + Emmanuel firstEmmanuel = new Emmanuel( "First", "Last", "[email protected]"); |
| 75 | + Emmanuel firstAEmmanuel = new Emmanuel("Firstname", "Lastname"); |
| 76 | + |
| 77 | + |
| 78 | + System.out.println(firstEmmanuel.getFirstName()); |
| 79 | + System.out.println(firstEmmanuel.getAge()); |
| 80 | + |
| 81 | + firstEmmanuel.setAge(65); |
| 82 | + System.out.println(firstEmmanuel.getAge()); |
| 83 | + |
| 84 | + System.out.println(firstEmmanuel.getFullName()); |
| 85 | + |
| 86 | + System.out.println(Emmanuel.count); |
| 87 | + |
| 88 | + System.out.println(getCount()); |
| 89 | + |
| 90 | + } |
| 91 | +} |
0 commit comments