class Team {
public Team
(Member member
) { // who is in this Team? this.member = member; // this 'member' is in this Team!
}
public static void main
(String[] args
) { Team myTeam = new Team(myMember); // success! Aureel now belongs to a team!
System.
out.
println(myTeam.
member.
getName()); System.
out.
println(myTeam.
member.
getType()); System.
out.
println(myTeam.
member.
getLevel()); System.
out.
println(myTeam.
member.
getRank()); }
}
private int level;
private int rank;
this.name = name;
this.type = type;
this.level = level;
this.rank = rank;
}
return this.name;
}
return this.type;
}
public int getLevel() {
return this.level;
}
public int getRank() {
return this.rank;
}
}
Y2xhc3MgVGVhbSB7CiAgICBNZW1iZXIgbWVtYmVyOwogICAgcHVibGljIFRlYW0oTWVtYmVyIG1lbWJlcikgeyAgLy8gd2hvIGlzIGluIHRoaXMgVGVhbT8KICAgICAgICB0aGlzLm1lbWJlciA9IG1lbWJlcjsgIC8vICB0aGlzICdtZW1iZXInIGlzIGluIHRoaXMgVGVhbSEKICAgIH0KCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICBNZW1iZXIgbXlNZW1iZXIgPSBuZXcgTWVtYmVyKCJBdXJpZWVsIiwgImxpZ2h0IiwgMTAsIDEpOyAKICAgICAgIFRlYW0gbXlUZWFtID0gbmV3IFRlYW0obXlNZW1iZXIpOyAvLyBzdWNjZXNzISBBdXJlZWwgbm93IGJlbG9uZ3MgdG8gYSB0ZWFtIQogICAgICAgU3lzdGVtLm91dC5wcmludGxuKG15VGVhbS5tZW1iZXIuZ2V0TmFtZSgpKTsKICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihteVRlYW0ubWVtYmVyLmdldFR5cGUoKSk7CiAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4obXlUZWFtLm1lbWJlci5nZXRMZXZlbCgpKTsKICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihteVRlYW0ubWVtYmVyLmdldFJhbmsoKSk7CiAgICB9Cn0KCmNsYXNzIE1lbWJlciB7CiAgICBwcml2YXR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