Question

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

Was it helpful?

Solution

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

it should be super.toString();

I hope this help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top