/** * Java 5.0 version of the famous "99 bottles of beer on the wall". * Note the use of specific Java 5.0 features and the strictly correct output. * * @author kvols */ import java.util.*; class Verse { private final int count; Verse(int verse) { count= 100-verse; } public String toString() { String c= "{0,choice,0#no more bottles|1#1 bottle|1<{0} bottles} of beer"; return java.text.MessageFormat.format( c.replace("n","N")+" on the wall, "+c+".\n"+ "{0,choice,0#Go to the store and buy some more"+ "|0