1. Write the top line only of a class definition for a public abstract class nam
ID: 3882186 • Letter: 1
Question
1. Write the top line only of a class definition for a public abstract class named Mystery 2. Which of the following statements regarding abstract classes is false? a. An abstract class can contain a mixture of abstract and regular methods. b. The user can declare an instance of an abstract class using the new operator. c. Any class derived from an abstract class must override all abstract methods found in the base cl d. It is possible to declare an array of abstract class references. 3. An array of base class reference is used where array elements point to a variety of objects in the class hierarchy. In which situation is the instanceof operator used? a. It is used to determine if an array reference points to an object of a particular type. b. It is used to determine if the array elements points to some object or is a null reference. c. It is used to change the type of the base class array reference to a particular derived class type. d. It is used to change the type of the object pointed to by the base class reference to a different type.Explanation / Answer
public abstract class Mystery{}: You need to include abstact keyword to identify class as abstract class b you can't create instance of abstract class using new keyword. should use extends keyword for another class. C instanceof will be used to determine the object of given type or not ex: String str = "Hello" if(str instanceof String) C you can't create direct instance with new keyword use implementation class for creating instance ex: Mystery mystery = new MysteryImpl(); B public class Cow extends Animal implenets Edible{} Array instanceArr = new Array(); for(int ind = 1; indRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.