How to declare abstract method in non-abstract class
<p>I want to declare a couple of abstract methods (so the implementation is required in the classes that inherit from this one) to fit my situation, which is:</p>

<p>I am making a puzzles solver program. So far I have 3 packages:</p>

<ul>
<li><code>games.puzzles</code></li>
<li><code>games.puzzles.rivercrossing</code></li>
<li><code>games.puzzles.rivercrossing.wolfgoatcabbage</code></li>
</ul>

<p>I don't want to get too specific but in the <code>games.puzzles.rivercrossing</code> package I have two classes that represent a bank and a state: <code>GenericBank</code> and <code>GenericState</code>.</p>

<p>Now, they define some behavior, but there are some methods that the classes that inherit from these <strong>must have</strong>, like <code>move()</code> to move one element from one bank to the other or <code>isPermitted()</code> and <code>isFinal()</code> to check the states.</p>

<p>For example, in the last package I have the <code>WolfGoatCabbageGame</code> class and it must have its own <code>Bank</code> and <code>State</code> classes which will inherit from the generic ones. These particular <code>Bank</code> and <code>State</code> classes must implement the methods I mentioned above, for example in the Wolf, Goat and Cabbage game, to check if the goat and the wolf are not in the same bank, etc.</p>

<p>So initially I declared the generic classes as <code>abstract</code>, and these methods to be implemented <code>abstract</code> as well:</p>

<pre><code>public abstract class GenericBank {
    // more members ...
    public abstract boolean move(Element element, GenericBank dst);
    // more members...  
}

public abstract class GenericState {
    // more members... 
    public abstract boolean isPermitted(GenericBank bank);

    public abstract boolean isFinal(GenericBank bank);
    // more members... 
}
</code></pre>

<p>And this looked like it'd work until I found out I had to instantiate <code>GenericBank</code> and <code>GenericState</code> objects, which of course can't be done if these classes are abstract.</p>

<p>So I had to remove the <code>abstract</code> qualifier from the classes.</p>

<p>So... what can I do? How can I declare <code>abstract</code> methods (or achieve the same behavior) in a non-<code>abstract</code> class?</p>