public class A{ public final static A instance = new A(); public static A getA(){ return instance; } //something to do }
package com.liangyumingblog; public class SimpleSinglton { private static class Instance { private final static SimpleSinglton instance = new SimpleSinglton(); } public SimpleSinglton getInstance() { return Instance.instance; } }