Question: (i) Create a User class that contains a single instance variable of String type to represent a user name, a constructor that takes a

(i) Create a User class that contains a single instance variable of String type to represent a user name, a constructor that takes a passed parameter to initialise the instance variable name, a getter method to get the name, a setter method to change the name to a new value, and a proper toString method that just returns the name of a User object. Write the main method so as to create 2 User objects and initialise them to your own given name and family name respectively, and then display these 2 User objects. (ii) Repeat the above question, with all the references to name there being replaced by the height of the corresponding user.
Step by Step Solution
There are 3 Steps involved in it
Heres the solution to the first part of your question which involves creating a User class with a name instance variable public class User private Str... View full answer
Get step-by-step solutions from verified subject matter experts
