public class J {
    private int x;

    public int getX() {
        doSomething();
        return x;
    }

    public void setX(int x) {
        doSomething();
        this.x = x;
    }

    private void doSomething() {
    }
}