how to do Timer task in java
<p>I just want to implement the following in Java , Do anyone have some idea..?</p>

<pre><code>public String method1(){

   //statement1
    .
    .
    .

   //statement 5
}
</code></pre>

<p>I want to set a timer for the statemen1 ( which involves some network communication ) . If the statement1 is not getting finished even after 25seconds , the control should go to statement 5 . how can I implement this in java ..?  </p>
