From 1ef1ff1a0bb6c47d5da2ca1aa5fca56a95b7a345 Mon Sep 17 00:00:00 2001 From: Emmanuel <56493177+Abstract410@users.noreply.github.com> Date: Fri, 28 Oct 2022 12:37:29 -0500 Subject: [PATCH] Added int date_of_birth as a new data variable Added date_of_birth to person 1 and 2 as an int and had the system print out date of birth for person 1. --- 17 - Classes and Objects/src/App.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/17 - Classes and Objects/src/App.java b/17 - Classes and Objects/src/App.java index 68a2568..e7875aa 100644 --- a/17 - Classes and Objects/src/App.java +++ b/17 - Classes and Objects/src/App.java @@ -3,7 +3,7 @@ class Person { // Instance variables (data or "state") String name; int age; - + int date_of_birth; // Classes can contain @@ -21,14 +21,17 @@ public static void main(String[] args) { Person person1 = new Person(); person1.name = "Joe Bloggs"; person1.age = 37; + person1.date_of_birth = 10311984; // Create a second Person object Person person2 = new Person(); person2.name = "Sarah Smith"; person2.age = 20; + person2.date_of_birth = 10312002; System.out.println(person1.name); + System.out.println(person1.date_of_birth); } -} \ No newline at end of file +}