To call methods on a class you must have a valid reference to that class, but how to get that reference will depend on how your code is structured, something we know little about. Perhaps you will need to pass a reference from one class into the other via a setter method or a constructor parameter, but I'm not sure. You might want to show us more about your code, but if you do, please use code tags so that your code is readable by us.

Also, please give us details on what you mean by "it doesn't work". Do you get an exception? A null pointer reference? an empty String? Also, are you able to get a reference to the variable of interest, but it does not hold information that you expect it to hold? Again, more information will be helpful for us.

It's not at all clear what durpdurp is supposed to be, as you didn't post real code. Typically, if there is some piece of data you want to store in an object, and you want to make it available to other classes, you would store it in an instance variable or a field (same thing -- different people use different terminology) and make it available through getter and setter methods.