1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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

Discussion in 'Java' started by eaglei22, Feb 19, 2012.

  1. eaglei22

    eaglei22 New Member

    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???
     
  2. virxen

    virxen New Member

    where do you declare class BadException ?
    is this class and your code in the same folder?
     

Share This Page