Question test = new Question();
useranswer = Integer.parseInt(JOptionPane.showInputDialog(null,
"What is the Result?" + "\n" + test.toString()));
我的toString问题类为什么我的toString()打印toString类而不是我的重写方法?
public String toSting() {
return "" + firstNum + " " + operator + " " + secondNum + " = ";
}
为什么我收到 “的getClass()。的getName()+ '@' + Integer.toHexString(hashCode()方法)” 我呼吁的toString格式而不是我的覆盖toString()在我的问题类?
公共字符串toSting(){ \t \t返回 “” + firstNum + “” +运算+ “” + secondNum + “=”; \t} – H22
'toSting()'不同于'toString()'。 –
哇,我很笨。谢谢。 – H22