class Man { private static int nextId; public int id; static { nextId = getLastDbId(); } { nextId++; id = nextId; } static int getLastDbId() { //具体实现 return 0; }}var man = new Man();//man.id is 1System.out.println("man.id is " + man.id);