-->

Password Check (Case Sensitive)


 This Java code defines a class called "CheckPass" which contains a method called "check()" that takes in a string input as a "password" and checks if it meets certain requirements. The requirements are:

  • The password should have at least 8 characters
  • The password should contain an uppercase letter, a lowercase letter, a numerical value, and a special character. The code imports several classes from Java's standard libraries including "java.lang.", "java.util.", and "java.util.regex.*" which are used to perform the check on the password. The check method uses regular expressions to check if the password contains an uppercase letter, a lowercase letter, a numerical value, and a special character. If the password does not meet the requirements, the method prompts the user to enter a new password and recursively calls itself with the new password as the input. Once the password meets the requirements, the method returns the password and the main method prints a message indicating that the password was saved successfully and also prints the saved password.