Ask 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 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.

+1
Answers (1)
  1. 8 April, 13:39
    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 & 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