How do you take the value of a static attribute inside a method when you have a variable with the same name in that method?

Asked

Viewed 21 times

0

When it is a non-static attribute you can use the this.nomeAtributo.

Example:

public class NomeDaClasse {
    private String atributo;

    public void (String atributo) {
        fazerAlgo(this.atributo);
        fazerAlgo(atributo);
    }

}

However, how is it done to catch if this attribute is static?

public class NomeDaClasse {
    private static String atributo;

    public void (String atributo) {
        fazerAlgo(?.atributo);
        fazerAlgo(atributo);
    }

}
  • NomeDaClasse.atributo

  • Yes! I forgot. Thanks!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.