It mainly depends on what you are looking for and what your specifications are! Do A, B and C reside in the same package (if so it is not very interesting)? What is the protection for the attribute name (public, protected, default, private?) ? Is data hiding important (if so you have to add a getter and setter)? You wrote 'use class B to change the name of class A'. You thus mean that the name is a class and not an instance attribute. So as Snigdha Solank wrote it, the variable 'name' must be static. W.