Question: JAVA- Write a program to read a single password from an input file and print if that password is valid or invalid. The criteria for
JAVA- Write a program to read a single password from an input file and print if that password is valid or invalid. The criteria for a valid password is as follows: 1. The password must be at least 8 characters long 2. The password must contain at least 1 digit (0-9) 3. The password must contain at least 1 uppercase letter 4. The password must contain at least 1 lowercase letter
Your program should contain two methods: 1) your main method, and 2) a second custom method to check if the password is valid.
Notes Each input file contains exactly one password. Your custom method should have a boolean return value. You will need to utilize some of Javas String methods in this program. Some of these may include String.length(), String.toUpperCase(), and String.charAt().
It should also use the following code:
for (int i = 0; i < password.length(); i++) {
if ( Character.isDigit(password.charAt(i)) ) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
