Enforce Noninstantiability With A Private Constructor
// Noninstantiable utility class
public class UtilityClass {
    // Suppress default constructor for noninstantiability
    private UtilityClass() {
        throw new AssertionError(); // Prevent being instantiate within itself
    }
 
    // Remainder omitted
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License