i need to access a variable from a class to another class currently running at the same time. my plan is to:

Save the values of the variable to a file and access it from the other class

other options i have
Use a database

use RMI

what other features in java that i can use??? what do you think is my best option???

Note:

the variable must not be static because i need to change it from time to time

not even 1 reply :sad:

impossible to say without knowing more context.

Well lets say

CLass A is a class that holds a button. and everytime i click it a boolean var would be give a value True.

Class B is a class that draws shape into a canvas. but it will only draw if the boolean variable in CLass A is true. after it has finished drawing the shape it will Access Class A's boolean variable and give it a value of false

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.