Oka. So i have this rather simple program, basically i want it to be able to count the number of hours it has been open.
My problem is that i am trying to use
import java.util.date;
Calendar calendar = Calendar.getInstance();
And apperently this does not update after the program has been launched. is there a work around? or am i just using it wrong?
Basically what im trying to do (for the lack of knowlagde on how to do it better =) ):
int time;
int time2;
time = calendar.get(Calendar.SECOND);
String containerInput;
containerInput = reader.readLine(); /*input to keep the program running*/
System.out.println(containerInput); //because my compiler complains *when the string is unused*/
time2 = calendar.get(Calendar.SECOND);
I have tried to do longer dummy loops to keep the program active as i thought the input request might have stopped the call from updating, i was wrong ^^
EDIT: i know it at the moment only gets seconds, but i cant w8 for one hour everytime i need to try the program..