JOptionPane 中的 Inluce 方法
Inluce Method inside JOptionPane
我想问一些关于在 JOptionPane.showMessageDialog 中放置方法的问题。
我这里有
public Double Result() {
Double NilaiAkhir = (getNilaiUjianKe1() * 0.20) + (getNilaiUjianKe2() * 0.25) + (getNilaiUlanganKe1() * 0.20) +
(getNilaiUlanganKe2() * 0.20) + (getNilaiTugas() * 0.15);
return Result;
}
然后我想把这个 Double Result() 放在 JOptionPane 里面
JOptionPane.showMessageDialog(
Student.Result()
);
但它不允许我这样做,我如何在 JOptionPane 中包含这样的方法?
你可以
JOptionPane.showMessageDialog(frame, Double.toString(Student.Result()));
而且你不能只 return 结果片段 1,
但你可以 return NilaiAkhir,如果你想这样做的话。
我想问一些关于在 JOptionPane.showMessageDialog 中放置方法的问题。
我这里有
public Double Result() {
Double NilaiAkhir = (getNilaiUjianKe1() * 0.20) + (getNilaiUjianKe2() * 0.25) + (getNilaiUlanganKe1() * 0.20) +
(getNilaiUlanganKe2() * 0.20) + (getNilaiTugas() * 0.15);
return Result;
}
然后我想把这个 Double Result() 放在 JOptionPane 里面
JOptionPane.showMessageDialog(
Student.Result()
);
但它不允许我这样做,我如何在 JOptionPane 中包含这样的方法?
你可以
JOptionPane.showMessageDialog(frame, Double.toString(Student.Result()));
而且你不能只 return 结果片段 1,
但你可以 return NilaiAkhir,如果你想这样做的话。