Is it possible to call a method in java at specific time? For example of I have a piece of code like this:
class Test{
public static void main(String ar
It is possible. You can schedule a method at some time using Timer and TimerTask.
For example:
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 10);
calendar.set(Calendar.MINUTE, 30);
calendar.set(Calendar.SECOND, 0);
Date alarmTime = calendar.getTime();
Timer _timer = new Timer();
_timer.schedule(foo, alarmTime);
Refer these links: