1. Answer true or false. a. A final local variable can be initialized when the v
ID: 3591763 • Letter: 1
Question
1. Answer true or false. a. A final local variable can be initialized when the variable is declared or before its first use anywhere in the method after it is declared. (True) b. A final instance variable can be initialized when the variable is declared or before its first use in any of the methods in the class. (True c. A final method can be overridden, but can be overloaded. (False] d. A final class cannot be extended. Truel 2. Which of the following statements about abstract class are true? Select all correct answers. a. abstract superclasses may contain instance variables. b. abstract superclasses may not contain implementations of methods. c. abstract superclasses must declare all methods as abstract. d. abstract suReCGI sses must declare all data members not given values as abstract e If a superclass declares an abstract method, a subclass must implement that method f An abstract class cannot be instantiated 3. Which of the following is folse? You should not call overridable methods from constructors-when creating a subclass object, this could lead to an overridden method being called before the subclass object is fully initialized. It is acceptable to call any of a class's methods from its constructors. When you construct a subclass object, its constructor first calls one of the direct superclass's constructors. If the superclass constructor calls an overridable method, the subclass's version of that method will be called by the superclass constructor It's acceptable to call a static method from a constructor a. b. c. d. Which of the following statements is false? 4. In Java SE 8, an interface may declare default methods-that is, public methods with concrete implementations that specify how an operation should be performed. When a class implements an interface, the class receives the interface's default concrete implementations if it does not override them When you enhance an existing interface with default methods-any class that implemented the original interface will break With default methods, you can dedare common method implementations in interfaces (rather than abstract classes), which gives you more flexibility in designing your classes a. b. c. d. 5. Which statement best describes the relationship between superclass and subclass types? A subclass reference cannot be assigned to a superclass variable and a superclass reference cannot be assigned to a subclass variable. A subclass reference con be assigned to a superclass variable and a superclass reference can be assigned to a subass variable. A superclass reference can be assigned to a subclass variable, but a subclass reference cannot be assigned to a superlass vriable. A subclass reference con be assigned to a superclass variable, but a superclass reference cannot be assigned to a subclass variable. a. b. C. d.Explanation / Answer
1) A final variable is initialized when it is declared or it can be initialized in the constructor
so a,b,c are false
d) final class cannot be extended is true
2)
An abstract class can contain implemented methods or unimplemented methods and it can contain data members
so option a and b are true
c and d is false
e) if an abstract superclass has unimplemented methods it should be implemented in subclass or declare sub class as abstract
f)an abstract class cannot be instantiated because there are unimplemented methods
3) option d is false
4)option c is false
5)option c is true
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.