【发布时间】:2022-07-16 13:37:49
【问题描述】:
String stockStr = " ";
for (StockRecordDTO stockNumber : stockID)
{
stockStr+=
String.format("the stock %s for Date %s with Quantity %d ",
stockNumber.getStock(),
stockNumber.getBusinessDate(),
stockNumber.getQuantity()
);
}
我正在尝试通过将值提取到字符串然后以这种方式打印来打印出值的 ArrayList。我从 DTO 类中获取值,并且我使用 string.format 方法遇到了错误,我曾经说过
ArgumentType: 'Big Decimal' 与指定格式的类型不匹配 '%d'
数量在 DTO 类中定义为 BIG Decimal。
那么我该如何解决呢?
感谢您提前提供帮助
【问题讨论】:
-
欢迎来到stackoverflow!
-
你可以用
%s代替%d。
标签: java string object bigdecimal string.format