如何在Java中将BigDecimal乘以整数?我试过这个,但不正确.
import java.math.BigDecimal;
import java.math.MathContext;
public class Payment {
int itemCost;
int totalCost = 0;
public BigDecimal calculateCost(int itemQuantity,BigDecimal itemPrice){
itemCost = itemPrice.multiply(itemQuantity);
totalCost = totalCost + itemCost;
return totalCost;
}
Run Code Online (Sandbox Code Playgroud) 我正在研究一种通过单击GUI上的按钮来重启我的Java应用程序的方法.我在网上搜索并遇到了main(new String [0]).我需要了解这是否是重启我的应用程序的有效方法.有人可以建议谢谢.
private void bnNewsaleActionPerformed(java.awt.event.ActionEvent evt) {
main( new String[0]);
}
Run Code Online (Sandbox Code Playgroud)
编辑这会更好吗?
private void bnNewsaleActionPerformed(java.awt.event.ActionEvent evt) {
classname.this.dispose();
main( new String[0]);
}
Run Code Online (Sandbox Code Playgroud) 除了使用之外button.setVisible(false),还有一种简单的方法可以将一组设置jButtons为隐形和可见吗?
该算法如下 - 当用户点击结账按钮时,显示一组支付按钮(面额按钮).试图研究是否有更简单的方法来实现这一目标.