final DateFormat dateFormat = DateFormat.getDateTimeInstance() ;
GregorianCalendar time = new GregorianCalendar();
GregorianCalendar limit = time;
limit.add(GregorianCalendar.HOUR_OF_DAY, 4);
String timeForm = dateFormat.format(time.getTime());
String limitForm = dateFormat.format(limit.getTime());
System.out.println(timeForm);
System.out.println(limitForm);
The output should be the time "now" followed by the time after 4 hours.
When it prints out, both timeForm and limitForm display the time after 4 hours. Why is that?