mercredi 21 février 2018

¿What's the error with my java code?

  1. So I don't know but I think there's a mistake in the last part...the problem is that I don't know exactly what's wrong or how to fix it. 2.The last part in the while seems to be the problem, but I need a more concrete explanation and how to solve this.

     import java.util.Scanner;
    public class Users{
        public static void main (String [] args){
    
        Scanner in = new Scanner(System.in);
    
        do 
        {
    
        System.out.println("Hello, please write your username: ");
        username = in.nextLine();
    
        System.out.println("Hello, please write your password: ");
        password = in.nextLine();
    
        if (!username.equals(Homie) && !password.equals(hello)){
    
        System.out.println("Sorry but username or password are not valid, ¿Do you want to create a new one yes/no (password al teast 8 digits): ");
        answer = in.nextLine();
    
    
        } else if (answer.equals(yes)){
    
        System.out.println("Select a new username: ");
        otherusername = in.nextLine();
    
        System.out.println("Select a new password: ");
        otherpassword = in.nextLine();
    
        System.out.println("Welcome:" + otherusername);
        }
    
    
        } while (username.equals(Homie) && password.equals(hello)){
    
        System.out.println("Welcome: " + username);
        }
    
        }
    }
    
    

Aucun commentaire:

Enregistrer un commentaire