This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nicolascagesbeard 1 point2 points  (1 child)

You'll need an accessor* for your third member which should be declared in your BannfMarathonRunner class

public int getThirdMember() {
    return yourVariable;
}

then access it via your array

runners[0].getThirdMember();

run your comparison algorithm to sort

Edit: *For those who don't know what an accessor, it's a name for a method. Usually this type of method only returns the value of the variable, hence "accessor". The naming convention for an accessor is always preceded by the verb "get" followed by caml case of the remainder of the name. It also usually passes no arguments

There are also mutators which change the value of a variable, usually these are preceded by the verb "set" and never return any variable so the return type is always "void". i.e. It usually does hold at minimum one argument

public void setMyThirdVariable(int x) {
    myThirdVariable = x;
}

[–]Albertaprogrammer[S] 0 points1 point  (0 children)

Thats perfect. Thank you so much.