The use of static variables can often cause problems and is not recommended in most cases.
getting its value to the other class
For one class to access the contents of an instance of another class, it needs a reference to that instance.
The preferred technique to access variables is to use getter methods.
A simple example:
OtherClass refToOtherClass = new OtherClass(); // get ref to OtherClass
...
int myVar = refToOtherClass.getVarValue();
...
class OtherClass {
int var;
public getVarValue( ) {
return var;
}
...