I'm making a small program that reads from a file (Serialized objectInputStream), which is a registry list where each entry has a boolean variable that is set to true or false.

In this program I have two separate JPanel-classes. One, the A-class, that can change the value of these variables, and the other, the B-class, checks if these variables are true or false.
These two classes are created under a gui-class with main-method. 

If I change the variables in the A-class, how can I see the new updated values in B-class?
I tried to do a ObjectInput- output streams in each class. That means that for each change the class wrote it out to a file and read it back in before changing/ reading.
This works, but is it optimal? Is there a better way to do this?

![model of program](https://i.stack.imgur.com/RpW5c.jpg)