I have two .java files and I want to access a variable of a method in one of the files and use it in another. However, I dont want to call the whole method and I dont want the method to return a value...I'll try to illustrate below
//file_A.java
class file_A{
//some code
void first_method(){
int variable_a=2; //variable used in this method for several things
}
}
//file_B.java
class file_B
{
//some code
void second_method(){
System.out.println("var"+variable_a);//ofcourse this does not work but Iam trying to do something like this
}
}
I hope this helps to explain my problem