Question: Can I get this in JOptionpane, please import java.io.*; import java.util.*; class PasswordVerifier {//class check the validity of password private String password; public PasswordVerifier(String a){
Can I get this in JOptionpane, please
import java.io.*; import java.util.*;
class PasswordVerifier {//class check the validity of password private String password; public PasswordVerifier(String a){ password = a; } public boolean verify(){ boolean upper,lower,digit; upper = false; lower = false; digit = false; if (password.length() < 6)//check the length is valid return false; for (int i=0; i
if (upper && lower && digit) return true; else return false; } }
public class Main{ public static void main(String[] args){
Scanner sc = new Scanner(System.in); System.out.print("Enter password: "); String pass = sc.next();//Taking the password from user PasswordVerifier pv = new PasswordVerifier(pass);//passing the user input password to check it is valid or not if (pv.verify()) System.out.println("Valid password"); else System.out.println("Invalid password");
} }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
