Java单例生成序列号
public class seqence6bit {
private int seq = 100000;
private seqence6bit() {
}
private static class seqence6bitcontainer {
private static seqence6bit instance = new seqence6bit();
}
public static seqence6bit getinstance() {
return seqence6bitcontainer.instance;
}
public synchronized string getseq() {
this.seq++;
if (this.seq >= 1000000) {
this.seq = 100000;
return "100000";
}
return string.valueof(seq);
}
}
补充:软件开发 , Java ,