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

后端 未结 6 1189
你的背包
你的背包 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:29

    NumberFormat percentageFormat = NumberFormat.getPercentInstance();
    percentageFormat.setMinimumFractionDigits(2);
    

提交回复
热议问题