public class ParametersDemo
1: //ParametersDemo.java
2:
3: public class ParametersDemo
4: {
5: public static void main(String[] args)
6: {
7: DemoSpecies s1 = new DemoSpecies(),
8: s2 = new DemoSpecies();
9: s1.setSpecies("Klingon Ox", 10, 15);
10: int aPopulation = 42;
11: System.out.println("aPopulation BEFORE calling tryToChange: "
12: + aPopulation);
13: s1.tryToChange(aPopulation);
14: System.out.println("aPopulation AFTER calling tryToChange: "
15: + aPopulation);
16:
17: s2.setSpecies("Ferengie Fur Ball", 90, 56);
18: System.out.println("s2 BEFORE calling tryToReplace: ");
19: s2.writeOutput();
20: s1.tryToReplace(s2);
21: System.out.println("s2 AFTER calling tryToReplace: ");
22: s2.writeOutput();
23:
24: s1.change(s2);
25: System.out.println("s2 AFTER calling change: ");
26: s2.writeOutput();
27: }
28: }