I have already declared and caught exception but still there is an error
10:33 04 Feb 2014
class HelloWorld extends Exception {
    HelloWorld(String s) {
        System.out.println("helllo" + s);
    }
}

class myclass {
    void go() throws HelloWorld {
        System.out.println("my mom");
    }
}

public class ting {
    public static void main(String[] args) {
        try {
            myclass h= new myclass();
            h.go();
        } catch(HelloWorld e) {
            throw new HelloWorld("world");
        }
    }
}

I read that, we always need to declare an exception till we catch it. As above, I am using custom exception HelloWorld and when I throw this exception in other class i.e. myclass. Moreover, I caught this exception in the main method. Why is it not working?

o/p : ting.java:17: error: unreported exception HelloWorld; must be caught or declared to be thrown
         throw new HelloWorld("world");
         ^
1 error 
java exception