I know this question has been asked a lot but I still not figuring the solution So My code is:
package com.mycompany1;
import java.util.Scanner;
public class App {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the username please: ");
String usernameup = input.nextLine();
System.out.print("Enter the password please: ");
int passwordup = input.nextInt();
System.out.println("Signed UP succesfully,Now sign IN");
System.out.print("Enter your username: ");
String username_in = input.nextLine();
System.out.print("\nEnter your password: ");
int passwordin = input.nextInt();
if (username_in == usernameup & passwordin == passwordup) {
System.out.println("Welcome "+usernameup);
}else if (username_in != usernameup & passwordin == passwordup) {
System.out.println("The username is wrong!!");
}else if (passwordin != passwordup & username_in == usernameup) {
System.out.println("The password is wrong!!");
}else {
System.out.println("Please check your informations!!");
}
}
}
(I'm beginner at Java) .. So the Scanner gets an input from the user in passwordup then skip the username_in input
I have searched a lot about it but still don't know where is the problem