title: error in the following code near throw IOException
body: <pre><code>import java.io.*;
  import java.lang.*;
  
  public class Propogate1
  {
  
  String reverse(String name)
  {
  if(name.length()==0)
      throw IOException("name");
  
  String reverseStr="";
  for(int i=name.length()-1;i&gt;0;--i)
  {
    reverseStr+=name.charAt(i);
  
  }
  return reverseStr;
  }
  
  public static void main(String[] args)throws IOException
  {
  String name;
  try
  {
          Propogate1 p=new Propogate1();
      p.reverse("java");
  
  }
  finally
  {
  System.out.println("done");
  }
  
  }
  
  }
  </code></pre>
  
  <p>I have to create a class propogate and main method which will call reverse(). In that if the name.length is null, it will throw an exception. If it is not null it will reverse the string. Pls help me</p>