java check string contains letters only code example Example: java if string contains character if (string.contains(character)