15.7. Summary

The important elements that you've covered in this chapter are:

  • The java.util.Arrays class provides static methods for sorting, searching, filling, and comparing arrays.

  • Objects of type Random can generate pseudo-random numbers of type int, long, float, and double. The integers are uniformly distributed across the range of the type int or long. The floating-point numbers are between 0.0 and 1.0. You can also generate numbers of type double with a Gaussian distribution with a mean of 0.0 and a standard deviation of 1.0 and random boolean values.

  • Classes derived from the Observable class can signal changes to classes that implement the Observer interface. You define the Observer objects that are to be associated with an Observable class object by calling the addObserver() method. This is primarily intended to be used to implement the document/view architecture for applications in a GUI environment.

  • You can create Date objects to represent a date and time that you specify in milliseconds since January 1, 1970, 00:00:00 GMT or as the current date and time from your computer clock.

  • You can use a DateFormat object to format the date and time for a Date object as a string. The format will be determined by the style and the locale that you specify.

  • A GregorianCalendar object represents a calendar set to an instant in time on a given date.

  • A regular expression defines a pattern that is used for searching text.

  • In Java, a regular expression is compiled into a Pattern object that ...

Get Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.