
Brian L. answered 10/01/19
Math Tutor - All Levels
In your main method, you are declaring 2 distinct objects - o as an object of type one, and t as an object of type two.
After you create object o, you set its class variables age and name to 4 and "john" respectively, but do not set object t's values.
When you create object t, this creates a new object of type two. While it does inherit the interface of object one, it does not receive any values from when you set them on object o. As a result, your age defaults to 0 and name defaults to null, resulting in the output you are seeing.
To get a different output, you would need to set the variables on object t:
t.age = 4;
t.name = "john";
or create object t from object o:
two t = o;