Formatting Messages: Date and Number
import java.text.MessageFormat;
import java.util.Date;
public class DateNumberSample {
public static void main(String args[]) {
Double kb = new Double(3.5);
Date today = new Date();
String pattern = "{0}K was deleted on {1}.";
Object[] arguments = { kb, today };
System.out.println(MessageFormat.format(pattern, arguments));
}
}
Related examples in the same category