Skip to content

Instantly share code, notes, and snippets.

@JeffML
Last active March 18, 2017 20:06
Show Gist options
  • Save JeffML/a3794f227a61fbe9d4587c9003d53d1e to your computer and use it in GitHub Desktop.
Save JeffML/a3794f227a61fbe9d4587c9003d53d1e to your computer and use it in GitHub Desktop.
BowlingBall, outer class
class BowlingBall {
private String petName;
BowlingBall() {
}
void setPetName(String petName) {
this.petName = petName;
}
String getPetName() {
return this.petName;
}
}
class Bowler {
private BowlingBall bowlingBall;
void setBowlingBall(b) {
this.bowlingBall = b;
}
BowlingBall getBowlingBall() {
return this.bowlingBall;
}
}
// test
BowlingBall bowlingBall = new BowlingBall();
Bowler bowler = new Bowler();
bowler.setBowlingBall(bowlingBall);
bowler.getBowlingBall().setPetName("Gutter Duster");
print bowler.getBowlingBall().getPetName()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment