In the previous chapter, Self-Test Question 16 described a class Person to represent a person. The class has instance variables for a person’s name, which is a string, and an integer age. These variables are name and age, respectively.
a. Write a default constructor for Person that sets name to the string "No name yet" and age to zero.
b. Write a second constructor for Person that sets name to a given string and age to a given age.
c. Write a static method createAdult() for Person that returns a special instance of this class. The instance represents a generic adult and has the name “An adult” and the age 21.
See the code in Person.java.
You might also like to view...
HTML features a label tag that is available for pairing text labels with form ____ when creating forms.
A. fields B. attributes C. behaviors D. groups
Printed content sometimes is referred to as a(n) ____________________.
Fill in the blank(s) with the appropriate word(s).
When setting up a mask for a MaskedTextBox object, select the Use Validating Type check box to cause the object to verify that the user entered valid numeric data.
Answer the following statement true (T) or false (F)
To protect files on your device's hard drive from hackers, turn on file and printer sharing.
Answer the following statement true (T) or false (F)