X934: Writing An Accessor

For this question assume you are writing a method within the following class:

public class Person
{
    private int age;

    public void setAge(int newValue)
    {
        age = newValue;
    }
}

Write a getter method for the field age called getAge.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.