Question
to different types to respond to methods of the
same name, each one according to the right type-specific behavior.
click below
click below
Question
classes.
Normal Size Small Size show me how
java mod 7
Question | Answer |
---|---|
It is the ability of objects belonging to different types to respond to methods of the same name, each one according to the right type-specific behavior. | Polymorphism |
It is the ability to redefine methods for derived classes. | Polymorphism |
Using one method identifier to refer to multiple functions in the same class | Method Overloading |
Creating more than one constructor in a class | Constructor Overloading |
creating multiple methods having same name in one class | Method Overloading |
Providing a different implementation of a method in a subclass of the class that originally defined a method. | Method Overriding |
It is the ability for a message/data to be processed in more than one form | Polymorphism |
What must be true if a child of an abstract parent class does not override all of the parent's abstract methods? | The child class itself must be declared to be abstract. |
The ability to define more than one function with the same name is called? | Polymorphism |
Which problem may arise if we use abstract class functions for polymorphism? | All the derived classes must implement the undefined functions |
Polymorphism is particularly effective for implementing layered software systems. (t/f) | True |
Which of the following is true about interfaces in java | - An interface can contain following type of members. - A class can implement multiple interfaces. - Many classes can implement the same interface. |
A class can inherit from multiple abstract classes. (t/f) | False |
Which of the following classes fail to compile? abstract class X { abstract void method(); } abstract class Y extends X { void Method() { } } abstract class Z extends Y { void Method() { System.out.println("Class Z"); } } | all compiles |
Can an object of a child type be assigned to a variable of the parent type? For example, Card crd; BirthDay bd = new BirthDay("Lucinda", 42); crd = bd; // is this correct? | Yes--an object can be assigned to a reference variable of the parent type. |
Can an abstract method be defined in a non-abstract class? | No--if a class defines an abstract method the class itself must be abstract. |
A method must do either of two things with a checked exception. What are those two things? | (1) Handle the exception in a catch{} block, (2) throw the exception to the method that called this method. |
Assertions can't be enabled or disabled on a class-by-class basis. | False |
It is bad practice to throw an AssertionError explicitly. | False |