FormattingNumbers

I was trying to do some hands-on formatting numbers.
my code:
NumberFormat currency= NumberFormat.getCurrencyInstance();
String res= currency.format(1234567.891);
System.out.println(res);
output:
? 1,234,567.89

I didnt get any currency symbol. anything i have to add to get it or wt can i do for it. pls let me know

It looks like it getCurrencyInstance was unable to determine the proper currency for your default locale. So we should call the version where you specify a particular Locale instead (for example: US):

var currency = NumberFormat.getCurrencyFormat(Locale.US);

Oh okay ok. thanks a lot for ur reply