DecimalFormat.setCurrency(Currency currency) has the following syntax.
public void setCurrency(Currency currency)
In the following code shows how to use DecimalFormat.setCurrency(Currency currency) method.
// ww w.ja v a 2s . c o m import java.text.DecimalFormat; import java.util.Currency; import java.util.Locale; public class Main { public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.setCurrency(Currency.getInstance(Locale.GERMANY)); System.out.println(format.getCurrency()); } }
The code above generates the following result.