130 Part II: Writing (Best web hosting) Your Own Java Programs

130 Part II: Writing Your Own Java Programs The world premiere of Al s All Wet Listing 6-2 is very nice, but the program in that listing doesn t do anything interesting. For a more eye-catching example, see Listing 6-3. In Listing 6-3, I make good on a promise I made in Chapter 5. The program in Listing 6-3 prints all the lyrics of the hit single, Al s All Wet. (You can find the lyrics in Chapter 5.) Listing 6-3: The Unabridged Al s All Wet Song import static java.lang.System.out; class AlsAllWet { public static void main(String args[]) { for (int verse = 1; verse <= 3; verse++) { out.print( Al s all wet. ); out.println( Oh, why is Al all wet? Oh, ); out.print( Al s all wet cause ); out.println( he s standing in the rain. ); out.println( Why is Al out in the rain? ); switch (verse) { case 1: out.println ( That s because he has no brain. ); break; case 2: out.println ( That s because he is a pain. ); break; case 3: out.println ( Cause this is the last refrain. ); break; } switch (verse) { case 3: out.println( Last refrain, last refrain, ); case 2: out.println( He s a pain, he s a pain, ); case 1: out.println( Has no brain, has no brain, ); } out.println( In the rain, in the rain. );
Our stuff is composed of devoted and highly-tainted professionals, creating a mix of powerful and high-quality web hosting perl services, check web hosting perl.

Leave a Reply