228k views
4 votes
Using the given definition of the Measurable interface:

public interface Measurable {
double getMeasure();
}

Consider the following code snippet, assuming that BankAccount has a getBalance method and implements the Measurable interface by providing an implementation for the getMeasure method:

Measurable m = new BankAccount(); System.out.println(_________________________);

Select the correct expression to display the balance of the bank account.

A) m.BankAccount.getBalance()
B) m.getBalance()
C) ((BankAccount) m).getBalance()
D) m.super.getBalance()

User Micrub
by
6.6k points

1 Answer

0 votes

Answer:

B

Step-by-step explanation:

B since "m" is declared in the BankAccount class, you don't need to use "m.BankAccount" like in the main method, so B is out. C is not necessary because m is already a BankAccount object, and D isn't necessary because you aren't extending a class.

User Simplelenz
by
5.8k points