This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The brute force way to do this is to simply provide a setter method:
However, it's not a good idea to just go around blindly providing that kind of direct access without a good reason. Sometimes it makes sense to do so, but often times it's better design to just give C1 real behavior through methods, and let those methods update C1's member variables as appropriate. As much as it practical, the details of C1's state should stay hidden from users of C1.
You should not have the same value in two classes. You should have the value in one class and one only. It should have one copy and one only. If you need the other class to use it, it can be provided by a public getXXX method. If you really need to signal the other object about a change, you are getting into more advanced practices: look for the observer pattern.