This age doesn't work for me…

  • 3
  • Locked
Think about what the program is doing. Fix the programming error so that person.age changes value. Hint: carefully review the adjustAge method
You can't complete this task, because you're not signed in.
Comments (6)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 22 , Iraq
21 September, 09:57
If the variable is static use the className.variable if not use keyword this.variable
Le Phan
Level 14 , Véry, France
14 December 2021, 05:44
To help solving the exercises more easier, one completely beginners should know that whenever a variable comes with prefix "static", it would call a "static variable." Otherwise, it is a non-static one. With this in mind and read the examples carefully would help you solve the two exercises efficiently.
Level 16
11 November 2021, 21:07
Think about variable masking here, one variable is masking the other as they are using the same name, you need to target the correct variable by using the this keyword.
Level 3 , Jeddah, United States
26 November 2021, 20:09
how and where
Level 16
30 November 2021, 21:41
you have 'age' defined as a class variable and you also have 'age' defined as a parameter variable in the adjustAge method. In the adjustAge method you can access the class variable using this.age & you can access the parameter variable using just age.
Level 26 , San Diego, United States
18 September 2021, 05:06
Great community help without divulging the exact answer. Good learning experience reading all the comments about using > this < which has always been too mysterious.