0% found this document useful (0 votes)
65 views1 page

Java User Authentication Guide

This Java program accepts a username and password from the user. It prompts the user to enter a password, checks that the password is between 6-10 characters long and only contains letters, and then prompts the user to re-enter the password to verify it matches the first entry. If the password criteria is met and the passwords match, it prints a confirmation message.

Uploaded by

Jeremy Kipgen
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views1 page

Java User Authentication Guide

This Java program accepts a username and password from the user. It prompts the user to enter a password, checks that the password is between 6-10 characters long and only contains letters, and then prompts the user to re-enter the password to verify it matches the first entry. If the password criteria is met and the passwords match, it prints a confirmation message.

Uploaded by

Jeremy Kipgen
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd

Write a Java program to accept name and password? Answer: import [Link].

Scanner; class Password { public static void main(String[] args) { Scanner input = new Scanner([Link]); //------ENTER A USERNAME [Link]("Welcome please enter your username and password."); [Link]("Username >>"); [Link](); //------PASSWORD AUTHENTICATION BEGIN String password = enterPassword(); while ( !checkPassword(password) ) { [Link]("Password must be 6 - 10 characters long!"); password = enterPassword(); } //------PASSWORD VERIFY String passwordverify = enterPassword(); while (![Link](passwordverify)){ [Link]("ERROR - Passwords DO NOT MATCH Re-Enter Passwords Again"); password = enterPassword(); } //------ACCEPT PASSWORD [Link]("Username and Password Accepted!"); } //--ENTER PASSWORD STATEMENT public static String enterPassword(){ String password; Scanner input = new Scanner([Link]); [Link]("Password >>"); password = [Link](); return password; } //--BOOLEAN CHECK PW public static boolean checkPassword(String password){ int length; length = [Link](); if (length < 6 || length > 11){ return false; } for (int i = 0; i < [Link]();i++){ if (![Link]([Link](i))) return false; } return true; }

You might also like