String length example

String length method in java is used to get the length of a given string.

String length method example


Please Note:
Before performing any operation on any dynamically generated String, check if the String is not null.
Else a NullPointerException is thrown.


1. String length – API