locale-specific formatting. : Formatter « Development « Java Tutorial






import java.util.Calendar;
import java.util.Formatter;
import java.util.Locale;

public class Main {

  public static void main(String args[]) {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();
    fmt = new Formatter();
    fmt.format("Default locale: %tc\n", cal);

    fmt.format(Locale.GERMAN, "For Locale.GERMAN: %tc\n", cal);
    fmt.format(Locale.ITALY, "For Locale.ITALY: %tc\n", cal);
    fmt.format(Locale.FRANCE, "For Locale.FRANCE: %tc\n", cal);
    System.out.println(fmt);
  }
}








6.4.Formatter
6.4.1.Write formatted output directly to the console and to a file.
6.4.2.Formatter.ioException()
6.4.3.new Formatter(new OutputStream('test.fmt'))
6.4.4.locale-specific formatting.