Question: (1) A class constructor method __________ . (a) must have the same name as the class it is declared within (b) is used to create
(1) A class constructor method __________ .
(a) must have the same name as the class it is declared within
(b) is used to create objects
(c) may be declared private
(d) both (a) and (b) above
(e) (a) , (b) and (c) above
2. Consider the class definition that is shown.
public class MyClass
{
public MyClass() { // code // }
// more code statements . . .
}
To instantiate an object of MyClass , what would you write?
(a) MyClass mc = new MyClass();
(b) MyClass mc = MyClass();
(c) MyClass mc = MyClass;
(d) MyClass mc = new MyClass;
(e) The constructor of MyClass should be defined as follows.
public void MyClass() { // code // }
For each of the following exercise, match the description on the left with an item on the right. Use each selection on the right only once.
_____ (3) one of four key words used in (a) mutator
object - oriented programming
_____ (4) an instance of a class (b) inheritance
_____ (5) capability of methods to exhibit (c) polymorphism
different behavior
_____ (6) allows a class to use the properties and (d) object methods of another class
_____ (7) used to hide certain details and only show (e) void the essential features of the object
_____ (8) another term for the " get " method (f) abstraction
_____ (9) a method that modifies the data of (g) encapsulation
an object
_____ (10) one of the four key words for a method (h) accessor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
