Chapter 10 - Multiple Choice Flashcards
- The extends keyword applies to
❑ a class inheriting from another class.
❑ a variable.
❑ a method.
❑ an expression.
a class inheriting from another class.
- A Java class can inherit from two or more classes.
❑ true
❑ false
false
- In Java, multiple inheritance is implemented using the concept of
❑ an interface.
❑ an abstract class.
❑ a private class.
an interface
- Which of the following is inherited by a subclass?
❑ all instance variables and methods
❑ public instance variables and methods only
❑ protected instance variables and methods only
❑ protected and public instance variables and methods
protected and public instance variables and methods
- What Java keyword is used in a class header when a class is defined as inheriting from an interface?
❑ inherits
❑ includes
❑ extends
❑ implements
implements
- A Java class can implement one or more interfaces.
❑ true
❑ false
true
- How do you instantiate an object from an abstract class?
❑ With any constructor.
❑ With the default constructor only.
❑ You cannot instantiate an object from an abstract class.
You cannot instantiate an object from an abstract class.
- When a class overrides a method, what object reference is used to call the method inherited from the superclass?
❑ inherited
❑ super
❑ class
❑ methodName
super
- Where should the following statement be located in the body of a subclass constructor?
super( );
❑ It should be the last statement.
❑ It should be the first statement.
❑ It can be anywhere.
It should be the first statement
- If a class contains an abstract method, then
❑ the class must be declared abstract.
❑ the class is not abstract.
❑ the class may or may not be abstract.
❑ all of the above
the class must be declared abstract.
- What can you tell about the following method?
public void myMethod( )
{
}
❑ This method is abstract.
❑ This method is not abstract.
This method is not abstract.