Class with only static methods - Enum or not
<p>Time after time I have a situation where I have an utility class containing only static methods.</p>

<hr>

<p><strong>The question is not about the fact of having such classes themselfes, so not a debate about utility classes. We just assume that there is a use case where this class makes sense.</strong></p>

<hr>

<p>Now I have seen different possibilities to prevent instantiation/extension:</p>

<ul>
<li>a private constructor and final class </li>
<li>using an enum instead of a class</li>
</ul>

<p>What is the best practice here? Could you elaborate the benefits/drawbacks of the two possibilities?</p>

<hr>

<p>Personally I prefer the enum solution, as it completely prevents instantiation and extension out of the box, but maybe I am wrong.</p>

<p>Thank you already!</p>