Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

Outline the steps involved in the right way to buy a business.

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago