Java 为什么我的toString()打印的是toString类而不是重写的方法?

Java 为什么我的toString()打印的是toString类而不是重写的方法?,java,Java,我的问题课 Question test = new Question(); useranswer = Integer.parseInt(JOptionPane.showInputDialog(null, "What is the Result?" + "\n" + test.toString() )); 为什么在我的问题类中,我调用toString时使用getClass.getName+'@'+Integer.toHexStringhashCode格式而不是重写的toString?t

我的问题课

Question test = new Question();

useranswer = Integer.parseInt(JOptionPane.showInputDialog(null, 
   "What is the Result?" + "\n" + test.toString() ));
为什么在我的问题类中,我调用toString时使用getClass.getName+'@'+Integer.toHexStringhashCode格式而不是重写的toString?

toString与toString不同

始终在方法重写之前添加@Override注释。 以后对于类似问题,请始终包含相关代码。 e、 g


公共字符串toSting{return+firstNum++operator++secondNum+=;}toSting和toString不一样。哇,我是哑巴。谢谢。以后,请包括所有相关的代码。好吧,那很刺痛。。。对不起的:P@MadProgrammer:哎哟。
public String toSting() {
    return "" + firstNum + " " + operator + " " + secondNum + " = ";
}
@Override  // don't forget this!
public String toString() {
    // code that returns a String
}