Ask Question
6 January, 11:21

EX 7.15 Imagine a game in which some game elements can be broken by the player and others can't. Create an interface called Breakable that has a method called break that takes no parameters and another called broken that returns a boolean result indicating whether that object is currently broken.

+2
Answers (1)
  1. 6 January, 12:45
    0
    public interface Breakable

    {

    public void break ();

    public boolean broken ();

    }

    Explanation:

    Here is the interface named Breakable

    This interface has two functions break () and broken ()

    break () method has no parameters

    broken () method returns a boolean result. As you can see boolean keyword is written before the method name which basically return true or false.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “EX 7.15 Imagine a game in which some game elements can be broken by the player and others can't. Create an interface called Breakable 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