// Simple program that demonstrates the use of String parameters to capture the // redundancy of various lines of output from a well-known song. public class StringParameter { public static void main(String[] args) { swallowed("spider", "fly"); swallowed("bird", "spider"); swallowed("cat", "bird"); swallowed("dog", "cat"); } // prints a line of the song using the names of two animals public static void swallowed(String animal1, String animal2) { System.out.println("She swallowed the " + animal1 + " to catch the " + animal2 + ","); } }