Hi,
Why dosent the following code work as intended.
public class testTimer {
public static void main(
String args[]) {
Timer t = new Timer(false);
t.scheduleAtFixedRate((new Ta()),System.currentTimeMillis(),1000);
}
}
public class Ta extends TimerTask {
public void run()
{try {
FileOutputStream fw = new FileOutputStream("D:/timer.txt",true);
PrintWriter pw = new PrintWriter(fw);
pw.println("Timer is working");
pw.close();
}catch(Exception e) {}
System.out.println("Timer is working");
}
}
when testTimer is run the timertask Ta is not scheduled...the run method is not called. Is there any mistake Iam doing here.
Thanks