Last active
March 18, 2017 20:06
-
-
Save JeffML/a3794f227a61fbe9d4587c9003d53d1e to your computer and use it in GitHub Desktop.
BowlingBall, outer class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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