0%
0 / 11 answered
String Manipulation Practice Test
•11 QuestionsQuestion
1 / 11
Q1
Password Validator: What is the result of the following code snippet when the input is "Z9xxxxxx"?
String p = input;
boolean hasUpper = p.toUpperCase().indexOf(p.substring(0, 1)) >= 0;
boolean hasDigit = p.indexOf("9") >= 0;
System.out.println(hasUpper && hasDigit && p.length() >= 8);
Password Validator: What is the result of the following code snippet when the input is "Z9xxxxxx"?
String p = input;
boolean hasUpper = p.toUpperCase().indexOf(p.substring(0, 1)) >= 0;
boolean hasDigit = p.indexOf("9") >= 0;
System.out.println(hasUpper && hasDigit && p.length() >= 8);