The actual use of this [duplicate]

0

I recently entered object-oriented programming and I'm taking my first steps in JAVA, but it's still quite abstract that using this() when referring to metadata and attributes would be equivalent to C pointers?

class Carro {
    String marca;
    String modelo;
    double capCombustivel;

   // Construtor usando this como referência os atributos
    public Carro(string nome){
        this.marca = marca;
        this.modelo = modelo;
        this.capCombustivel = capCombustivel;
    }
}

Could anyone give me examples where this . if it is necessary What other ways could it be used in addition to facilitating variable identification and code reading?

    
asked by anonymous 27.12.2018 / 22:08

0 answers