private static final Class<? extends UserManager> type;
private static void setType(final Class <? extends UserManager> theType){
if(type == null) type = theType;
else throw new IllegalStateException("Type already set.");
}
I want to get something like the above to work but it won’t compile because type isn’t final anyone know how to do this in Java? Is it possible?
This is intrinsically impossible.
finalmeans that you cannot change it after initialization is complete.