Re: Cannot find symbol error
Quote:
I get a Cannot find symbol error.
What symbol and on what line of the program?
Where is the variable: getGegeten defined?
The syntax of the statement: Vos.getGegeten
says that the variable is a static variable in the Vos class.
Re: Cannot find symbol error
javac Vos.java
Vos.java:7: cannot find symbol
symbol : variable getGegeten
location: class Vos
Vos.getGegeten = 0;
^
1 error
Vos.java extends Dier.java, Dier.java implents IDier.java
Vos.java:
Code:
class Vos extends Dier {
public int getGegeten() {
return 1;
}
public void resetGegeten() {
Vos.getGegeten = 0;
}
}
Dier.java
Code:
abstract class Dier implements IDier {
}
IDier.java
Code:
public interface IDier {
public int getGegeten();
public void resetGegeten();
}
Re: Cannot find symbol error
Where is the variable: getGegeten defined?
I see a method with that name but no variable.
Re: Cannot find symbol error
Isn't that defined in the part?:
Code:
public int getGegeten() {
return 1;
}
Re: Cannot find symbol error
Do you know what a variable is?
What you have posted is the definition of a method.
You do not assign values to methods. You call them to perhaps do some task and perhaps return a value.
The method you have posted returns an int with value 1.
A variable definition starts with a datatype followed by the variable's name:
String someString ...
int someInt ...
Re: Cannot find symbol error
ok, I understand it now, thank you for helping