Other java.util Classes and Interfaces

The java.util package contains a number of other classes and interfaces that provide capabilities for many of your programs. These remaining classes and interfaces are covered in the following subsections.

The Random Class

The Random class provides a template for the creation of random number generators. It differs from the random() method of the java.lang.Math class in that it allows any number of random number generators to be created as separate objects. The Math.random() method provides a static function for the generation of random double values. This static method is shared by all program code.

Objects of the Random class generate random numbers using a linear congruential formula. Two constructors ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams 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.