将数字格式化
import java.util.java.text.DecimalFormat;
class Xl3<T>{
T inAccount;
T leftAccount;
public static void main(String[] args){
Xl3<Object> banklist = new Xl3<Object>();
banklist.inAccount = 8888.0;
banklist.leftAccount = 18888.89;
DecimalFormat df = new DecimalFormat("###,###.###");
System.out.print(
"存款金额:"+df.format(banklist.inAccount)+
"\n账户余额:"+df.format(banklist.leftAccount)
);
}
}