java algorithium


SUBMITTED BY: Guest

DATE: May 29, 2013, 10:19 p.m.

FORMAT: Text only

SIZE: 924 Bytes

HITS: 14230

  1. import java.util.Date;
  2. public class algorithium{
  3. public static void main(String[] args) {
  4. //create first date object
  5. Date d1 = new Date();
  6. //make interval of 10 millisecond before creating second date object
  7. try{
  8. Thread.sleep(10);
  9. }catch(Exception e){
  10. }
  11. //create second date object
  12. Date d2 = new Date();
  13. //use boolean after(Date anotherDate) method of Date Class to
  14. //check whether a date is after the specified date
  15. System.out.println("First Date : " + d1);
  16. System.out.println("Second Date : " + d2);
  17. System.out.println("Is second date after first ? : " + d2.after(d1));
  18. System.out.println(" if value is yes: True ");
  19. Date d3 = new Date();
  20. System.out.println("Is second date after first ? : " + d2.after(d1));
  21. System.out.println(" if value is yes: True ");
  22. }
  23. }

comments powered by Disqus