Ask Question
4 February, 17:28

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.

+4
Answers (1)
  1. 4 February, 18:10
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers