You create a text message with the session method createTextMessage. You can either initialize the message body directly at creation time
TextMessage  outMsg = mySession.createTextMessage("Hello, World!");
or simply create an empty message and then use its setText method (see Table 2–9 ) to set its content:
TextMessage  outMsg = mySession.createTextMessage();
outMsg.setText("Hello, World!");
Table 2–9  Text Message Composition
Method| Name | Description | 
|---|---|
| Set content string |