Password Validation program.java

 import java.util.Scanner;


public class cPasswordValidation {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int password;

        do {
            System.out.println("Masukkan password: ");
            password = scanner.nextInt();
        } while (password != 1234);

        System.out.println("Password benar, akses diterima.");
    }
}


OUTPUT : if the password entered is correct




OUTPUT : if the password entered is incorrect



Komentar