Ask Question
2 August, 11:40

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.

+3
Answers (1)
  1. 2 August, 13:34
    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?
Get 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 & 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