1

I want the price to be in Euros €, what do i need to change with the code below?

I have it in dollars so far

DecimalFormat dollars = new DecimalFormat( "$0.00" ); 
Sean Collins
  • 25
  • 1
  • 8

2 Answers2

1

Unless, I'm missing something; you could change this

DecimalFormat dollars = new DecimalFormat( "$0.00" ); 

to

DecimalFormat euros = new DecimalFormat( "€0.00" );  // <-- euros not dollars.
Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249
1

you can even do it this way

Locale italian = new Locale("it", "IT", "EURO");
Locale.setDefault(italian);
NumberFormat nf = NumberFormat.getCurrencyInstance();
System.out.println(nf.format(123));
SparkOn
  • 8,806
  • 4
  • 29
  • 34