Preview:
public with sharing class EagerInitializedSingleton {

//private static instance of the class
private static final EagerInitializedSingleton instance = new EagerInitializedSingleton();

//private constructor to avoid creating an instance anywhere outside of this class
private EagerInitializedSingleton(){}

public static EagerInitializedSingleton getInstance(){
    return instance;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter