1. If a class is named Student, what name can you use for a constructor for
this class?
2. When defining a constructor, what do you specify for the type of the value
returned? A primitive type? A class type? void?
3. What is a default constructor?
4. Does every class in J ava automatically have a default constructor? If not,
when is a default constructor provided automatically by Java and when is
it not provided?
5. In the program PetDemo shown in Listing 6.2, you can replace the calls to
the three set methods with one call to setPet. Write this invocation.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here