Ask Question
20 July, 23:31

Write a public interface named Test with the following behavior: a method getDuration that returns a Duration object. a method check that accepts an int parameter and returns a Result object. a method getScore that returns a double.

+5
Answers (1)
  1. 21 July, 00:20
    0
    The code to this question can be given as:

    Code:

    public interface Test

    {

    public abstract Duration getDuration ();

    public abstract Result check (int ar);

    public abstract double getScore ();

    }

    Explanation:

    An interface is similar to Java Class, and it has only static variables and abstract methods. Java uses a multi-inheritance interface. Many Java interfaces can be implemented by a Java class. All methodologies were implicitly public and abstract within an interface.

    In the given question we a function that is "Test" and inside the interface, we define three functions that are defined as:

    First, we declare a "getDuration" method that returns the Duration object. Second, we declare a "check" method that accepts an integer variable that is "a". Third, we declare a "getScore" method that returns a double value.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a public interface named Test with the following behavior: a method getDuration that returns a Duration object. a method check that ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers