Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the given definition of the Measurable interface: public interface Measura

ID: 3847569 • Letter: U

Question

Using the given definition of the Measurable interface: public interface Measurable { double get Measure { 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 Measurable (); System.out.println (m.get Measure()); 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. Which of the following statements about interfaces is NOT true? An interface can supply a default implementation. Interfaces can make code more reusable. An interface can describe the state that should be maintained. An interface describes the behavior that an implementation should supply. Which of the following is the correct class header for a MouseclickListener class that wants to take advantage of the do-nothing methods provided by the MouseAdapter class? class MouseClickListener implements MouseAdapter class MouseClickListener extends MouseAdapter interface MouseClickListener extends MouseAdapter class MouseClickListener implements MouseListener Which of the following statements about the object.clone method is NOT true? Its return type is the same as the cloned object. It returns a new object that has a state identical to the cloned object. If the object being cloned does not implement the Cloneable interface, then it throws an exception. It does not clone mutable instance variables.

Explanation / Answer

question 5)

the given java program is:

public interface measurable
{
   double getmeasure();
  
}
class bankaccount implements measurable
{
void getbalance()
{
  
}

public static void main (String args[])
{
  
}
measurable m=new measurable();
System.out.println(m.getmeasure());

}

the answer is code does not compile because interface types cannot be instantiated.here in the above program the interface measurable cannot be instantiated because the interfaces cannot be instantiated and the get measure method does not return a string.

question 6)

answer is an interface describes the behaviour that an implementation should supply.it is not true because the behavior should be desribed outside an interface inside a class to which interface gets implemented.

public interface measurable
{
   double getmeasure()
   {
       double measure;
       System.out.println(measure);
   }
  
}
abstract class bankaccount implements measurable
{
void getbalance()
{
  
}

public static void main (String args[])
{
  

bankaccount b=new bankaccount();
b.getmeasure();

}
}

the output is compile time error as the method in interface should be described in the class in which interface gets implemented.the bahaviour of the method should be outside an interface, inside a class.

The correct class header for a MouseClickListener class that wants to take advantage of the do-nothing methods provided by the MouseAdapter class is class MouseClickListener extends  MouseAdapter.

object.clone method returns a new object that has a state identical to the cloned object is not true.