Hello.
The task requirement states "The Person class's adjustAge method should increase the Person's age by 20."
The code for the adjustAge method has age = age+20. I am thinking that this is correct as the formula adds 20 from the passed in class variable. I tried multiplication 20* 20 and age = age + age + 20. All have been unsuccessful.
I may have missed something. Could someone look at my code and give me some feedback?
package en.codegym.task.jdk13.task04.task0401;
/*
This age doesn't work for me…
*/
public class Solution {
public static void main(String[] args) {
Person person = new Person();
System.out.println("Age: " + person.age);
person.adjustAge(person.age);
//System.out.println("Adjusted age: " + person.age);
}
public static class Person {
public int age = 20;
public void adjustAge(int age) {
age = age + 20;
System.out.println("The age in adjustAge() is: " + age);
}
}
}