Java : Checking letter case (Upper/Lower) within a string (Homework looking for advise)
<p>The problem that I am have is that I can not get my Password Verification Program to check a string to ensure that 1 of the characters is upper case and one is lower case, it will check the whole string for one of the other and print the error message based on which statement it is checking. I have looked over this site and the internet for an answer and I am unable to find one. Thank you for your help in advance. I apologize if this has been answer somewhere else already. Below is my current code.</p>

<pre><code>import java.util.Scanner;

public class password
{
    public static void main(String[] args)
    {
        Scanner stdIn = new Scanner(System.in);
        String password;
        String cont = "y";
        char ch;
        boolean upper = false;
        boolean lower = false;


        System.out.println("Setting up your password is easy. To view requirements enter Help.");
        System.out.print("Enter password or help: ");
        password = stdIn.next();
        ch = password.charAt(0);

        while (cont.equalsIgnoreCase("y"))
        {

            while (password.isEmpty())
            {
                System.out.print("Enter password or help: ");
                password = stdIn.next();

            }

            if (password.equalsIgnoreCase("help"))
            {
                 System.out.println("Password must meet these requirements." +
                     "\nMust contain 8 characters.\nMust contain 1 lower case letter." +
                     "\nMust contain 1 upper case letter.\nMust contain 1 numeric digit." +
                     "\nMust contain 1 special character !@#$%^&amp;*\nDoes not contain the word AND or NOT.");

                password = "";

            }

            else if (password.length() &lt; 8)
            {
                System.out.println("Invalid password - Must contain 8 charaters.");
                password = "";
            }


            else if (!(Character.isLowerCase(ch)))
            {
                for (int i=1; i&lt;password.length(); i++)
                {
                   ch = password.charAt(i);

                    if (!Character.isLowerCase(ch))
                       {  
                        System.out.println("Invalid password - Must have a Lower Case character.");
                        password = "";
                       }
                     // end if

                } //end for

            }

            else if (!(Character.isUpperCase(ch)))
            {

                for (int i=0; i&lt;password.length(); i++)
                {

                    ch = password.charAt(i);

                    if (!Character.isUpperCase(ch))
                    {
                        System.out.println("Invalid password - Must have an Upper Case character.");
                        password = "";
                    } // end if
                } //end for

            }



            else
            {
                System.out.println("Your password is " + password);

                System.out.print("Would you like to change your password? Y/N: ");
                cont = stdIn.next();
                password = "";
            }

            while (!cont.equalsIgnoreCase("y") &amp;&amp; !cont.equalsIgnoreCase("n"))
            {
                System.out.print("Invalid Answer. Please enter Y or N: ");
                cont = stdIn.next();
            }                

        }


    } // end main
} // end class
</code></pre>
