• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between LocalTime.MIN and LocalTime.MIDNIGHT and where it is used

 
Greenhorn
Posts: 8
Hibernate Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hii all,
I m preparing for OCAJP SE-8 and i have a question related to Java Date & Time API.
LocalTime.MIN -  Minimum supported time, that is, 00:00
LocalTime.MIDNIGHT  -  Time when the day starts, that is, 00:00

Both constants have same value 00:00 then what is the difference between them ?
Why there are two separate variable having same value in same class ?
 
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suppose they did this so MAX and NOON both have sensibly named counterparts. If there was only MIN or only MIDNIGHT, you would have to write either:
Or:

Now, you can write both:
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are even the same object. From src.zip of the latest Java 8 SDK:
 
Adarsh Patel
Greenhorn
Posts: 8
Hibernate Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You for helping and clearing doubt...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic