您好我正在尝试将这两个双变量转换为String,以便它可以显示在JLabel AnswerLabel
double GasType;
double CostOfGas;
Answer = GasType * CostOfGas;
this.AnswerLabel.setText(Answer);
答案 0 :(得分:0)
这将有效:
this.AnswerLabel.setText("" + Answer);
但这更好:
this.AnswerLabel.setText(String.valueOf(Answer));