diff options
author | Julian T <julian@jtle.dk> | 2020-09-03 10:21:33 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-09-03 10:21:33 +0200 |
commit | b64f5e9e206ba1f9254199a48bbec1846201d0ae (patch) | |
tree | b7dde25371571dddebf523afb4e723c8f9b0bc1d /sem5/oop/m1/src/Person.java | |
parent | 0e3cafc48570e4b675ecac11663a5f777b24d339 (diff) |
Added first oop assignment
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); + } +} |