Hello I have two classes into the package "pack3" One is the extension of the other one. The "Up" class is:

package pack3;

public class Up{
int k=1;
public String toString(){
    return String.valueOf(k);
    }
 }

The "Down" class is: package pack3;

public class Down extends Up{
int k=2;

public String toString(){
    return k+", "+super.ToString();
    }
 }

I have this error on the shell: Down.java:6: error: cannot find symbol return k+", "+super.ToString(); ^ symbol: method ToString() 1 error

有帮助吗?

解决方案

return k+", "+super.ToString();  

it should be super.toString();

I hope this help.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top