This age doesn't work for me…

  • 4
  • Locked
Sometimes we all want to change our age. First, they don't want to sell you cigarettes or beer. Then your hair starts thinning and your back aches! A programmer may not have control over time, but he or she has total control over data in programs. In this task, we correct an error so that a Person object's age variable receives a different value.
You can't complete this task, because you're not signed in.
Comments (33)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Elias Daniel Hung
Level 4 , Caracas
16 July 2021, 03:29
Keep on, keep trying, if you feel like you can't, seek help and you will find it ... in the midst of this pandemic that takes away our loved ones, and the problems you may have, fight for a better future, cheer up. ..
Level 18
30 June 2021, 18:53
key line in the lecture "The local variable masks the instance variable". so you need to use the keyword this to refer to the age instance variable
Level 8 , Moscow, Russian Federation
8 March 2021, 14:44
Thanks to iqbalhussain
Level 15 , Providence, United States
7 June 2020, 17:57
- age shouldn't be the parameter in the adjustAge method - age belongs t the person class - so just change the parameter name of the adjudge method - it should work - hope this helps
kar-fai chow
Level 8 , Hong Kong, Hong Kong
17 November 2020, 09:24
unfortunately, not in this case One of the requirement is to force the parameter to be named "age"
Level 11 , Banja Luka, Bosnia and Herzegovina
15 February 2021, 11:01
Yes it is the requirement, however generally speaking I think it is better to give unique variable names as Edddieg suggested to exclude the unnecessary code debugging...
Level 10
16 April 2020, 03:50
easy, you just need to understand the age belongs to where, the class or the method and how to change it.
locanto B
Level 4 , Pune, India
10 April 2020, 19:16
Not able to view the Requirements under Conditions tab. Created the file as per instructions to check whether requirements section will display/load the requirement, but encountered the same issue.
Alex Vypirailenko Java Developer at Toshiba Global Comme
11 April 2020, 09:27
It's because you've reached the end of the translated content. In order to proceed, you will need to continue on the English language version of the course. However, you will also need a subscription.
andy 6473
Level 9 , Bangalore, India
6 April 2020, 15:35
please understand the concept of static and non static variable . this will help you in solving the problem
Level 7 , Princeton, NJ, usa
19 December 2019, 00:47
Hi I am getting the right answer. The method is increasing the age. But I am getting an error. plz help
Level 11 , Radomsko, Poland
28 October 2019, 21:53
It's thanks to the hints of Pushkar Patil
Level 8 , San Ramon, Costa Rica
6 October 2019, 15:03
Two key lecture points to remember in order to resolve this: - An instance variable can't be accessed from static methods - When you declare a variable inside a method, that variable exist only in that method and takes precedence even if there's an instance variable with that name.