Method one: the class final
Method two: declaration of the class constructor is private, class provides a static method, to complete the initialization of the class. The following code:
public class Base{ private Base(){} public static Base ini(){ Base a=new Base(); return a; } public static void main(String[] args) { Base base=Base.ini(); } }