"The approach you suggest (different names) would work, or you could take advantage of Java's object system, and use boxed values (such that the class member is just an Object) or generics, such that the type is a parameter." . . . .