Basically, a method can throw an exception when something wrong happens. That's what the "throw" keyword is for. You already know sun's tutorial, so you are already familiar with checked and unchecked exceptions. If you throw a checked exception from a method, you have to declare it, that's what the "throws" keyword is for. When you want to call this method, it tells you that this method throws TestException and that it should be delt with.
In the above example, the name must not be null. You check that name is not null. If it is null, you throw a TestException. If TestException is a checked exception, you have to declare that the sayHello method throws it. So you declare your method as "public String sayHello(String name) throws TestException".
The code calling this method will have to deal with this exception. So you should have something like :