Ask Question
22 January, 13:26

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.

+1
Answers (1)
  1. 22 January, 13:31
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers