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