Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Java "throws" on method, can't find symbol (http://www.go4expert.com/forums/java-throws-method-symbol-t27832/)

eaglei22 19Feb2012 15:09

Java "throws" on method, can't find symbol
 
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 21Feb2012 00:47

Re: Java "throws" on method, can't find symbol
 
where do you declare class BadException ?
is this class and your code in the same folder?


All times are GMT +5.5. The time now is 15:01.