checking values to be nonnull
using String constructor