Skip to content · ⁨Saltar al contenido⁩

The this Keyword · ⁨La Palabra Clave this⁩

Handout · ⁨Material⁩ Watch lesson · ⁨Ver lección⁩

A parameter can hide the field it should update

  • An object has name "Ada". setName(String name) runs name = name; with the argument "Bo".
  • Both unqualified names refer to the parameter, so the object still has "Ada". this.name = name assigns the parameter value to the field instead.
A parameter can hide the field it should update

Handout · ⁨Material⁩

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP