True or False: A constructor must have the same name as the class name.
True
Oops!
Check
Okay!
Check
10
True or False: Private instance variables are the interface to the class.
False
Oops!
Check
Okay!
Check
10
You have created a Motorcycle class which has a constructor with no parameters. Which of the following statements will construct an object of this class?
Motorcycle myBike = new Motorcycle();
Oops!
Check
Okay!
Check
10
True or False: A constructor should always return a value.
False
Oops!
Check
Okay!
Check
10
True or False: A constructor initializes the instance variables of an object.
True
Oops!
Check
Okay!
Check
10
You are creating a class named Employee. What is the statement that correctly declares a constructor for this class?
public Employee()
Oops!
Check
Okay!
Check
10
True or False: A class can have more than one constructor.
True
Oops!
Check
Okay!
Check
10
A constructor is invoked when _________________ to create an object.
the new keyword is used
Oops!
Check
Okay!
Check
banana
Go to last place!
Oops!
magnet
Take 20 points!
Okay!
fairy
Take points!
5
10
15
20
25
thief
Give points!
5
10
15
20
25
10
What is wrong with this code?
The constructor must not have a return type declared.
Oops!
Check
Okay!
Check
10
True or False: A call to a constructor must always have construction parameters.
False
Oops!
Check
Okay!
Check
10
If you do not provide a constructor in a class, which of the following is correct?
The compiler will generate a constructor with no arguments.
Oops!
Check
Okay!
Check
10
True or False: All instance variables should be declared as private and most instance methods should be declared as public
True
Oops!
Check
Okay!
Check
10
Which statement calls a constructor with no construction parameters?