make java code sample match the actual API (#11398)
make java code sample match the actual API (#11398)


Fixes #https://github.com/apache/pulsar/issues/11397

### Motivation

Make docs clearer

### Modifications

make java code sample match the actual API


yahoo/pulsar,merlimat/pulsar,merlimat/pulsar,merlimat/pulsar,massakam/pulsar,yahoo/pulsar,merlimat/pulsar,massakam/pulsar,massakam/pulsar,yahoo/pulsar,yahoo/pulsar,massakam/pulsar,merlimat/pulsar,merlimat/pulsar,massakam/pulsar,massakam/pulsar,yahoo/pulsar,yahoo/pulsar