格式错误:线程" main"中的异常java.util.UnknownFormatConversionException:Conversion ='。'

时间:2016-04-12 01:32:43

标签: java formatting

我试图让每个变量打印出两位小数,但我不知道我做错了什么。有什么帮助吗?

System.out.printf("%.2",custNum + "\t" + beginBal + " \t " + financeCharge + "\t\t" +
                          purchases + " \t  " + payments + "\t\t" + endBal); 

1 个答案:

答案 0 :(得分:1)

您的格式String应为%.2f,每个字词应为System.out.printf("%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f%n", custNum, beginBal, financeCharge, purchases, payments, endBal); 。像,

$ci = get_instance();
        $ci->load->library('email');
        $config['protocol'] = "smtp";
        $config['smtp_host'] = "ssl://smtp.gmail.com";
        $config['smtp_port'] = "465";
        $config['smtp_user'] = "xxxxxxx@gmail.com";
        $config['smtp_pass'] = "xxxxxxx";
        $config['charset'] = "utf-8";
        $config['mailtype'] = "html";
        $config['newline'] = "\r\n";

        $ci->email->initialize($config);