FileDocCategorySizeDatePackage
RomanYear.javaAPI DocExample686Sat Jan 27 21:50:34 GMT 2001None

RomanYear

public class RomanYear extends Object
Print the current year in Roman Numerals

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)


		RomanNumberFormat rf = new RomanNumberFormat();
		Calendar cal = Calendar.getInstance();
		int year = cal.get(Calendar.YEAR);

		// If no arguments, just print the year.
		if (argv.length == 0) {
			System.out.println(rf.format(year));
			return;
		}
		
		// Else a micro-formatter: replace "-" arg with year, else print.
		for (int i=0; i<argv.length; i++) {
			if (argv[i].equals("-"))
				System.out.print(rf.format(year));
			else
				System.out.print(argv[i]);	// e.g., "Copyright"
			System.out.print(' ");
		}
		System.out.println();