簡體   English   中英

我無法在Eclipse中使用逗號格式化

[英]I can't format with comma in eclipse

我使用eclipse進行Java編程。 我想將10999.9999編譯為11,000.00。 這是我寫的代碼:

String x = "10999.9999";
double y = Double.parseDouble(x);
DecimalFormat formatter = new DecimalFormat("#,###.00");
System.out.println(formatter.format(y));

那么它給出的輸出為11000.00,沒有逗號。 我用cmd編譯了代碼,並且效果很好。 所以我認為我的日食有問題,或者可能是我需要打開一些設置。

還要提及:我的Eclipse永遠不會編譯逗號

代碼 輸出

String x = "10999.9999";
double y = Double.parseDouble(x);
DecimalFormat formatter = new DecimalFormat("###,###.00");
System.out.println(formatter.format(y));

將輸出

11.000,00

在此處檢查IDEONE DEMO

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM