문제

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