String length example

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

String length method example

Output

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

Reference

1. String length – API

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn