how to throw exception if any website is unavailable using java code
<p>I am working with java.
  I have one url as a input.I am trying to open url using java code.
  I am using:</p>

<pre><code>   URL url=new URL("http://doctorwho.time-and-space.co.uk/index.php");
   URLConnection conn=url.openConnection();
   InputStream in=conn.getInputStream();
</code></pre>

<hr>

<p>here I have passed one link as a input,but this website is unavailable.Here I want to throw an 
exception on opening this url,but it is not throwing any exception,it is executing properly.
Please help me,how to catch this exception if website is unavailable.</p>
