質問

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