import CodeBlock from "@theme/CodeBlock";
import java_examples from "!!raw-loader!../../../../../bindings/java/examples/java-app/src/main/java/org/iota/client/example/ExampleApp.java";
const javaFunctionName = "public static void simpleMessage",
  indexStart = java_examples.indexOf(javaFunctionName);
const nextJavaFunctionName = "public static void getMessageMetadata",
  indexEnd = java_examples.indexOf(nextJavaFunctionName);
const simple_message = java_examples.substring(indexStart, indexEnd);

You can use the [`Client.message()`](./../libraries/java/api_reference#message-clientmessagebuilder) to easily send any
message over the network. Alternatively, there is a convenient
[MessageSender](./../libraries/java/api_reference#messagebuilder) helper class with chaining calls that prepares a message
instance and broadcasts it over the network.

<CodeBlock className="language-java">{simple_message}</CodeBlock>

**Output example**:

```string
{
  message: {
    networkId: '14379272398717627559',
    parentMessageIds: [
      '03ddc83fad172a322fb00fb4e449436e9d1117ff390879100647c650a30c2d52',
      '252798210fa9816f6fd40f1b19095da9f2dc88ae06fc4c0523a928a29d0d782e',
      'a8e4f4cd49227068424ead8da187a48fdaa7ce8ffc4b9ac0ee2d5d3f2fcd7e70',
      'dbbc8044bc624b3378e1dda83ab95f9be468b06a6a9806c76a70353182028cf9'
    ],
    payload: null,
    nonce: '9223372036854784215'
  },
  messageId: '10dbee9cf3c58507725861b34ac711058dc13f709be1a6d21f1dc0af17b06379'
}
```

- `messageId` is a unique id that refers to the given message in the network.
