<< Chapter < Page Chapter >> Page >

Answer and Explanation

Listings

I recommend that you open another copy of this document in a separate browser window and use the following links to easilyfind and view the listings while you are reading about them.

Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Ap0040: Self-assessment, Logical Operations, Numeric Casting, String Concatenation, and the toString Method
  • File: Ap0040.htm
  • Originally published: 2002
  • Published at cnx.org: 12/02/12
  • Revised: 12/03/14
Disclaimers:

Financial : Although the Connexions site makes it possible for you to download aPDF file for this module at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, youshould be aware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version ofthe module.

In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale onAmazon.com showing me as the author. I neither receive compensationfor those sales nor do I know who does receive compensation. If you purchase such a book, please be aware that it is a copy of a modulethat is freely available on cnx.org and that it was made and published without my prior knowledge.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.

Answers

Answer 10

C. Sun Dec 02 17:35:00 CST 2012 1354491300781

Explanation 10

The noarg constructor for the Date class

The Date class has a constructor that takes no parameters and is described in the documentation as follows:

"Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearestmillisecond."

In other words, this constructor can be used to instantiate a Date object that represents the current date and time according to the system clock.

A property named time of type long

The actual date and time information encapsulated in a Date object is apparently stored in a property named time as a long integer.

Milliseconds since the epoch

The long integer encapsulated in a Date object represents the total number of milliseconds for the encapsulated date and time, relative tothe epoch, which was Jan 01 00:00:00 GMT 1970.

Earlier dates are represented as negative values. Later dates are represented as positive values.

An overridden toString method

An object of the Date class has an overridden toString method that converts the value in milliseconds to a form that is more useful for a human observer, such as:

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?

Ask