Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2018
    Thanked 0 Times in 0 Posts

    Matching password with username

    Hello ,i'm a beginner in coding.
    So i wrote a little script to connect to something ( in my imagination ) . But i wanted to created two set , one for Usernames , and the other for passwords , but i want to like , link every username to a specefic password.
    Here is the code i wrote ,i want you guys , if it is possible to check if there is a way to match a username with a password without using Sql tables or something in that kind.
    import java.util.*;
    public class sum{
    	public static Scanner info = new Scanner(System.in);
    	public static boolean checking = false;
    	public static String getUserName(String username) {
    		return username;
    	public static String getPassword(String password) {
    		return password;
    	private static void recoveryUserName() {
    		String usernm = getUserName("Username");
    		System.out.println("Your username is : " + usernm);
    	private static  void recoveryPassword() {
    		String passw = getPassword("Password");
    		System.out.println("Your password is : " + passw);
    	private static void createAccount() {
    		String name;
    		String pass;
    		Set<String> account = new LinkedHashSet<>();
    	public static void main(String[]args) {
    	do {
    		System.out.println("Please enter Your Username:");
    		String usernm = info.next();
    		System.out.println("Please enter Your password");
    		String passw = info.next();
    		if (!usernm.equals(getUserName("Username")) || !passw.equals(getPassword("Password"))) {
    			System.out.println("You entered false informations");
    			System.out.println("Did you forget your username or password?");
    			String recoveryInCase = info.next();
    			else if(recoveryInCase.equals("password")){
    				System.out.println("Where were you born? : ");
    				int year = info.nextInt();
    				}else {
    					System.out.println("We were unable to recover your password. Sorry, try later");
    			checking = false;
    		}else {
    			checking = true;
    	}while(checking == false );

  2. #2
    Senior Coder
    Join Date
    Dec 2005
    Thanked 79 Times in 79 Posts
    Sql tables or something in that kind.
    No, as soon as you realize that number of users can be humongous, you will see that.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts