At LINE A, int is converted to String.
At LINE B, boolean is converted to String.
At LINE C, float is converted to String.
At LINE D, character array data is converted to string using valueOf method.
At LINE E, a part of array data is converted to Stringi.e.5 characters from index 0.
At LINE F, a part of array data is converted to Stringi.e.6 characters from index 6.

THINGS TO TRY

Try converting other data types like char, double, long, Object.

Insert

sample = String.valueOf(null);

This statement calls valueOf(char[]) method, which generates a NullPointerException.

Insert

sample = String.valueOf( (Object)null);

This statement calls valueOf(Object) method. A String object having value null is returned.