Question: 1. If a class contains at least one abstract method, it is a(n) __________ class. 2. Classes from which objects can be instantiated are called
1. If a class contains at least one abstract method, it is a(n) __________ class.
2. Classes from which objects can be instantiated are called __________ classes.
For questions 3 through 9, state whether each of the statements is true or false. If false, explain why.
3. All methods in an abstract class must be declared as abstract methods.
4. Invoking a subclass-only method through a superclass variable is not allowed.
5. If a superclass declares an abstract method, a subclass must implement that method.
6. An object of a class that implements an interface may be though of as an object of that interface type.
7. An interfaces type can be used as an arguments type in a method. 8. Abstract methods in an interface must use the abstract keyword. 9. Abstract classes do not have constructors. 10. The keyword __________ can be used to determine if a variable is actually a subclass type. 11. How can a programmer ensure that a class is never extended?
12. How can a programmer allow only certain methods in a class to be overridden, but not others?
13. If no exceptions are thrown in a try block, where does control proceed to when the try block completes execution?
14. Should a conventional application catch Error objects? Explain. 15. What is the key reason for using the finally block?
16. State whether the following exceptions are checked or unchecked exceptions. (Hint: You will need to know the inheritance hierarchy of each of these exception classes: its superclass, its superclasss superclass, etc. This can be found near the top of the Javadoc documentation for each
Answers to the following questions can be found or determined by reading Chapters 10, 11, and 15 in the textbook. Unless otherwise stated, each question is worth 5 points.
Note: The sum of point totals for all questions is more than 100 points. Students who earn more than 100 points will receive extra credit.
class. Google should return the Javadoc of the class as the first result when you search for java 9 javadoc className, replacing className with the exceptions name.)
java.lang.ArithmeticException java.lang.ClassNotFoundException java.io.IOException java.lang.NumberFormatException java.sql.SQLException
17. Which class contains the format method for writing to a text file? 18. Which class can be used to retrieve Strings, numeric primitives, or full lines of text from a text
file? 19. Which interface must a class implement in order for its objects to be serialized? 20. Which class contains the writeObject method for serializing an object? 21. Which class contains the readObject method for deserializing an object?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
