Field Access

Within an instance method's definition, you can access the values of any fields declared in the class by just writing their name.

class Elmo {
    int age;

    void sayHello() {
        IO.println("Hi, I'm Elmo");
        IO.print("I am ");

        // You can use elmo's age by just writing "age"
        IO.print(age);
        IO.println(" years old.");
    }
}

void main() {
    Elmo elmo = new Elmo();
    elmo.age = 3;

    elmo.sayHello();
}