this i my first attempt at asking a question so hopefully it shows correctly. Basically what I need the program to do is to ask the user for a preset account number and password and only allow them 3 attempts. I then want to call up another method when both requirements are met so i can continue with the program. The first problem i have is that when i enter the correct password its is still showing as incorrect and i don't know why, then i would like to know if i have call the method within the if statement correctly. Thanks.
import java.util.Scanner;
public class Part4 {
public static void main(String[] args) 
{
    String password = "password", passwordattempt = null;
    int accnum = 123456789, acctry = 0, tries = 0;
    Scanner input = new Scanner (System.in);
    while (acctry != accnum){
    System.out.println("\nPlease enter your account number");
    acctry = input.nextInt();
        if (acctry != accnum)
            System.out.print("That number is incorrect. Please try again.");
        else
            if (acctry == accnum)
            {
                while (tries < 3)
                {
                    System.out.println("\nPlease enter password");
                    passwordattempt = input.next();
                    if (passwordattempt != password){
                        System.out.print("That password is incorrect");
                        tries++;
                        }
                    else
                        if (passwordattempt == password){
                            System.out.print("That is correct");
                            AccountDetails.Details(args);
                            }
                }
                System.out.print("\nYou have exceeded the ammount of tries");
            }               
        }
}
public static class AccountDetails {
    private static void Details(String[] args){
        System.out.print("it works");
    }
}
}
 
     
    