/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
public class Main
{
public static void main(String[] args) {
String special_char = "~`!@#$%^&*()-_=+\\|[{]};:'\",<.>/?";
char CC;
boolean numP = false;
boolean upper = false;
boolean lower = false;
boolean special = false;
System.out.print("Enter a string: ");
for (int i = 0; i < input.length(); i++) {
CC = input.charAt(i);
if (Character.isDigit(CC)) {
numP = true;
} else if (Character.isUpperCase(CC)) {
upper = true;
} else if (Character.isLowerCase(CC)) {
lower = true;
} else if (special_char.contains(String.valueOf(CC))) {
special = true;
}
else{
System.out.print("Invalid login");
}
}
return
numP && upper && lower && special;
}}
}
Comments
Leave a comment