Question: Using the given definition of the Measurable interface: 2 Consider the following code snippet, assuming that BankAccount has a getBalance method and implements the Measurable

Using the given definition of the Measurable interface:
2
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 Measurable();
System.out.println(m.getMeasure());
Which of the following statements is true?
The code executes, displaying the measure of the Measurable object.
The code does not compile because interface types cannot be instantiated.
The code compiles but generates an exception at run time because getMeasure does not return a String.
The code compiles but generates an exception at run time because m does not reference a BankAccount object.
Using the given definition of the Measurable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!