declaration of constant errors
I'm having a bit of a problem here. I just changed my variables into constants, and I'm getting errors on it. I can't pin point the problem can someone help me out.
publicclass MazeExceptionextends Exception
{
final String message;
final Throwable cause;
public MazeException(String message)
{
super(message);
}
public MazeException(String message, Throwable cause)
{
super(message, cause);
}
}
[939 byte] By [
xc100a] at [2007-11-26 18:24:24]

You need to assign a value to each of your constants, as in, for example,
final String message = "This is the message";
However, declaring message and cause in your subclass of Exception looks suspicious since an Exception already contains these fields (variables). Are you sure you want them there?
They are not constants, they are final instance variables.
To make them into constants add the static modifier. To make them accessible to other classes, if you need to, add the public modifier as well;
public static final String message = "Some text in here";
Then, you can refer to them within the class using their simple name, from outside the class with their fully qualified name.
Also, I cannot see anywhere where the constants are initialised. All you constructors seem to do is pass their parameter values on up to the matching constructor in the superclass.
I think I figured it out.
public class MazeException extends Exception
{
public MazeException(final String message, final Throwable cause)
{
super(message, cause);
}
public MazeException(final String message)
{
super(message);
}
}