How do I format my percent variable to 2 decimal places?

后端 未结 6 1187
你的背包
你的背包 2021-02-05 09:51

This program is basically working with text files, reading the data & performing functions:

while(s.hasNext()){
    name= s.next();

    mark= s.nextDouble()         


        
6条回答
  •  不思量自难忘°
    2021-02-05 10:20

    It may be best to acquire your percent formatter through NumberFormat.getInstance(Locale locale) and using the setMinimumFractionDigits methods (and maybe the others).

提交回复
热议问题