代码如下:
错误如下:
本次计算出的纯收入是:Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '%d'
at java.util.Formatter.format(Unknown Source)
at java.io.PrintStream.format(Unknown Source)
at java.io.PrintStream.printf(Unknown Source)
at aa.Bank.income(Bank.java:11)
at aa.Example7_5.main(Example7_5.java:8)
错误如下:
本次计算出的纯收入是:Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '%d'
at java.util.Formatter.format(Unknown Source)
at java.io.PrintStream.format(Unknown Source)
at java.io.PrintStream.printf(Unknown Source)
at aa.Bank.income(Bank.java:11)
at aa.Example7_5.main(Example7_5.java:8)
错误的代码在bank.java的第11行,正确的应该是
System.out.printf("本次计算出的纯收入是:%d元\n", netIncome)