Java "throws" on method, can't find symbol

eaglei22's Avatar, Join Date: Jan 2012
Light Poster
In one class I do:
public void setLeft(int left) throws BadException
{
if (left < 0 || left > 639)
throw new BadException();
else
x1 = left;
}

then in another class I do:

public static void main(String args[])
{
try
{
l1.setLeft(3000);
}
catch (BadException ex)
{
System.out.println("error message");
ex.printStackTrace();
}
}


I keep getting a cannot find symbol
symbol : class BadException
location: class Line
public void setLeft(int left) throws BadException
^

I can't figure it out.. What am I doing wrong???
virxen's Avatar, Join Date: Nov 2009
Pro contributor
where do you declare class BadException ?
is this class and your code in the same folder?