How do you specify what the Java application says?

You can use prerecorded speech or text-to-speech in a Java voice application by using any of the following subclasses of MediaType. These media classes specify the sounds that the caller hears:

You can also use arrays of MediaType objects to make a composite sequence of any of the media elements. All the methods capable of playing a message can accept arrays of MediaTypes. This allows your applications to play chains of MediaType objects in one operation.

You can make any data item presentable to the caller using the Playable interface. For example, the name, date of birth, and salary retrieved from an employee record in a database could be spoken as TextToSpeech, AudioDate and AudioCurrency items respectively.