Java String format(Locale l) Example
String class format(Locale l) method example
String class format(Locale l) method example. This example shows you how to use format(Locale l) method.This method Returns a formatted string using the specified locale, format string,and arguments.
Here is the code:-
/*
* @(#) Formatstring2.java
*Program Returns a formatted string using the specified locale, format string, and arguments.
* @Version 01-May-2008
* @author Rose India Team
*/
import java.util.*;
public class Formatstring2
{
public static void main(String[] args)
{
double pi = Math.PI;
System.out.format("%f%n", pi);
//Returns a formatted string using the specified locale, format string, and arguments.
System.out.format(Locale.FRANCE, "%-10.4f%n%n", pi);
}
} |
null
|