Is it possible to access an instance of a variable in one class from another class in Java.
Let’s say you have the following in Class A:
private BlockingQueue<byte[]> buffer = new LinkedBlockingQueue<byte[]>();
I want to make changes to the queue in this class and then be able to use to access it from another class.
How would i access the instance of buffer from another class? Is it even possible?
Add a getter:
Then if you have an instance of Whatever: