Follow along with the video below to see how to install our site as a web app on your home screen.
Not: This feature may not be available in some browsers.
import java.util.Scanner;
public class SifreKontrol {
public static **** main(String[] args) {
System.out.print("Şifreyi Girin: ");
String sifre=new Scanner(System.in).next();
if (sifre.length!=6) {
System.out.println("Şifre 6 haneli olmalıdır.");
return;
}
if (sifre[0]=='0') {
System.out.println("İlk hane 0 olamaz.");
return;
}
if (sifre[0]==sifre[1] && sifre[0]==sifre[2] && sifre[0]==sifre[3] && sifre[0]==sifre[4] && sifre[0]==sifre[5]) {
System.out.println("Bütün karakterler aynı olamaz.");
return;
}
if ((sifre[0]<'a' || sifre[0]>'z') && (sifre[1]<'a' || sifre[1]>'z') && (sifre[2]<'a' || sifre[2]>'z') && (sifre[3]<'a' || sifre[3]>'z') && (sifre[4]<'a' || sifre[4]>'z') && (sifre[5]<'a' || sifre[5]>'z')) {
System.out.println("En az bir küçük harf kullanılmalıdır.");
return;
}
if (sifre[0]==' ' || sifre[1]==' ' || sifre[2]==' ' || sifre[3]==' ' || sifre[4]==' ' || sifre[5]==' ') {
System.out.println("Şifre boşluk içeremez.");
return;
}
System.out.println("Şifre geçerlidir.");
return;
}
}
import java.util.Scanner;
public class PasswordCheck {
public static **** main(String[] args) {
System.out.print("Please enter the password to be checked: ");
String password=new Scanner(System.in).nextLine();
if (password.length()!=6) {
System.out.println("Password must be 6 digits long.");
return;
}
if (password.charAt(0)=='0') {
System.out.println("First digit cannot be '0'.");
return;
}
if (password.charAt(0)==password.charAt(1) && password.charAt(0)==password.charAt(2) && password.charAt(0)==password.charAt(3) && password.charAt(0)==password.charAt(4) && password.charAt(0)==password.charAt(5)) {
System.out.println("At least one character used must be different from others.");
return;
}
if ((password.charAt(0)<'a' || password.charAt(0)>'z') && (password.charAt(1)<'a' || password.charAt(1)>'z') && (password.charAt(2)<'a' || password.charAt(2)>'z') && (password.charAt(3)<'a' || password.charAt(3)>'z') && (password.charAt(4)<'a' || password.charAt(4)>'z') && (password.charAt(5)<'a' || password.charAt(5)>'z')) {
System.out.println("At least one lowercase letter must appear in the password.");
return;
}
if (password.charAt(0)==' ' || password.charAt(1)==' ' || password.charAt(2)==' ' || password.charAt(3)==' ' || password.charAt(4)==' ' || password.charAt(5)==' ') {
System.out.println("You can't use empty spaces in the password.");
return;
}
System.out.println("The password is valid.");
return;
}
}
sh-4.3# java PasswordCheck
Please enter the password to be checked: abc
Password must be 6 digits long.
sh-4.3# java PasswordCheck
Please enter the password to be checked: 012fda
First digit cannot be '0'.
sh-4.3# java PasswordCheck
Please enter the password to be checked: 123456
At least one lowercase letter must appear in the password.
sh-4.3# java PasswordCheck
Please enter the password to be checked: a12 34
You can't use empty space in the password.
sh-4.3# java PasswordCheck
Please enter the password to be checked: a12345
The password is valid.
Tamam ismini düzelttim oldu çok sağol gerçekten iyi akşamlar
package kontrol;
import java.util.Scanner;
public class Uyum {
/**
* @param args
*/
public static v_oid main(String[] args) {
// TODO Auto-generated method stub
Scanner oInput = new Scanner(System.in);
System.out.println("Please enter your password:");
String enteredValue = oInput.next();
System.out.println("your password is " + enteredValue);
int lengthOfPass= enteredValue.length();
System.out.println("Length of Password: " + lengthOfPass);
if (lengthOfPass == 6){
System.out.println("Your Password has 6 characters.");
if (!Character.isWhitespace(enteredValue.charAt(0)) || !Character.isWhitespace(enteredValue.charAt(1)) || !Character.isWhitespace(enteredValue.charAt(3)) || !Character.isWhitespace(enteredValue.charAt(4)) || !Character.isWhitespace(enteredValue.charAt(5))){
System.out.println("Your Password does not contain a Space" );
if (enteredValue.startsWith("0")){
System.out.println("Password's first Character is 0");
if(enteredValue.charAt(0) != enteredValue.charAt(1) ){
System.out.println("Characters of passwords are not same" );
if (Character.isLowerCase(enteredValue.charAt(0)) || Character.isLowerCase(enteredValue.charAt(1)) || Character.isLowerCase(enteredValue.charAt(2)) || Character.isLowerCase(enteredValue.charAt(3)) ||Character.isLowerCase(enteredValue.charAt(4)) || Character.isLowerCase(enteredValue.charAt(5))){
System.out.println("At least,a Character is lowercase" );
}
else {
System.out.println("Your Password does not contain a lowercase");
return;
}
}
}
else {
System.out.println("Password's first character is not 0");
return;
}
}
else
{
System.out.println("Your Password contains a Space" );
return;
}
}
else {
System.out.println("Your Password is different than 6 characters. Please change it.");
return;
}
}
}