can any body help me to understand the program of K&B book on page 243 . The program is saying to make a method that will take a string & return reverse & also if we will not supply any string ( lenght() == 0 ) then it will throw a new exception .
You did not declared in your code snippet the clas MyException. If your class you exception is a subclass of RuntimeException there will no be any problem, because Runtime exceptions are unchecked. However if MyException is subclass of MyException, but not subclass of RuntimeException you will have either to handle exception in your reverse method or throw it by means of the throws clause up to your main method, where you will have to handle it or add, once again, the trhows clause.