aspose file tools*
The moose likes Beginning Java and the fly likes meaning? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "meaning?" Watch "meaning?" New topic
Author

meaning?

Donald Wynn
Greenhorn

Joined: Dec 04, 2002
Posts: 29
I would like to know what this line of code means
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
Andrew Fischer
Greenhorn

Joined: Nov 18, 2002
Posts: 21
That line of code constructs a Calendar object initialized to the current date and time in the default time zone.

Sun Documentation for Calendar


Andrew Fischer
SCJP
Donald Wynn
Greenhorn

Joined: Dec 04, 2002
Posts: 29
What does that mean?
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
It is creating a variable named cal of type Calendar and then calling the constructor of the Calendar class using the "new" keyword to create an instance of Calendar that is looking at the PC that it is running on to find out what the default timezone for that PC is. If this is running on a server it would pick up the timezone for the server.
[ fixed small typo -ds ]
[ December 04, 2002: Message edited by: Dirk Schreckmann ]

"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: meaning?