Skip to main content

Practice Code Structure

Section 1.33 Fill-in-the-blank

Checkpoint 1.33.1.

The function isValidPassword() takes a String input, password, and returns a boolean. Complete the function by filling in the blanks so it returns false when the password is less than 8 characters or contains any spaces. Otherwise, it returns true.
  • You can use thelength()function to check the length of any String. For example: password.length() returns the length of password.
  • You can use thecontains() function to check whether a String contains a specific substring. For example, password.contains("a") returns true when password has a substring "a".
public static boolean isValidPassword(String password) {   
  	   return .....Blank............... ; 
}
Write your responses here:
Blank:
You have attempted 1 of 2 activities on this page.