diff options
Diffstat (limited to 'sem5/oop/m1/src/Person.java')
-rw-r--r-- | sem5/oop/m1/src/Person.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sem5/oop/m1/src/Person.java b/sem5/oop/m1/src/Person.java new file mode 100644 index 0000000..4ed517c --- /dev/null +++ b/sem5/oop/m1/src/Person.java @@ -0,0 +1,16 @@ + +public class Person { + protected String name; + protected String gender; + protected short age; + + public Person(String name, String gender, short age) { + this.name = name.equals("Victor") ? "Viktor" : name; + this.gender = gender; + this.age = age; + } + + public String toString() { + return String.format("%s[gen: %s, age: %d]", name, gender, age); + } +} |