I have a method (ex. helpMethod) that appears in many of my project classes and does something with a variable (ex. xVar) present in all of these classes as a private class property. I would like to make this method static in a default class and use it from there. Is it possible to avoid having to pass xVar as an argument to the static implementation?
Something like:
class helpClass {
    static void helpMethod() {
        return ++xVar;
    }
}
class demoClass {
    private int xVar = 0;
    int addToXVar() {
        helpClass.helpMethod();
    }
}
Instead of:
class helpClass {
    static void helpMethod(int xVar) {
        return ++xVar;
    }
}
class demoClass {
    private int xVar = 0;
    int addToXVar() {
        helpClass.helpMethod(xVar);
    }
}
 
    