JAVA HOMEWORK Question 6 When you overload a method, the type, order, and number
ID: 3673458 • Letter: J
Question
JAVA HOMEWORK
Question 6
When you overload a method, the type, order, and number of parameters must exactly match the original method.
Select one:
a. True
b. False
Question 7
When you override a method, the type, order, and number of parameters must exactly match the original method.
Select one:
a. True
b. False
Question 8
The equals method inherited from Object determines:
Select one:
a. whether two references refer to the same object in memory.
b. whether two objects have the same instance variables.
c. whether two references have the same type.
d. whether two objects have the same instance variable values.
Question 9
Declaring a method final means that
Select one:
a. it cannot be accessed from outside its class.
b. it cannot be overloaded.
c. it cannot be overridden.
d. it cannot be accessed through an invoking object.
Question 10
Consider the classes below, declared in the same package.
class A {
int a;
public A() {
a = 7;
}
}
class B extends A {
int b;
public B() {
b = 8;
}
}
Which of the following is true? Select all that apply.
Select one or more:
a. a is an instance variable
b. A reference of type B can be treated as a reference of type A. (B is an A)
c. After the constructor for class B executes, the variable a will have the value 7.
d. A reference of type B has two integer characteristics as its instance data.
e. After the constructor for class B executes, b will have the value 8.
A reference of type A can be treated as a reference of type B. (A is a B)
f. b is an instance variable.
Explanation / Answer
6. When you overload a method, the type, order, and number of parameters must exactly match the original method.
False
7. When you override a method, the type, order, and number of parameters must exactly match the original method.
True
8. The equals method inherited from Object determines:
d. whether two objects have the same instance variable values.
9. Declaring a method final means that
c. it cannot be overridden.
10
Consider the classes below, declared in the same package.
class A {
int a;
public A() {
a = 7;
}
}
class B extends A {
int b;
public B() {
b = 8;
}
}
Which of the following is true
a. a is an instance variable
c. After the constructor for class B executes, the variable a will have the value 7.
e. After the constructor for class B executes, b will have the value 8.
f. b is an instance variable.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.