I'm having some trouble with this section of code:

for(int i = 0; i < MAX_NUM ;i++)
        {
            subList[i].readIn();
            
            System.out.println("\nDo you want to enter another subscriber? "
                    + "(Y/N): ");
            anyMoreSub = keyboard.nextLine().toUpperCase();
                
                if (anyMoreSub.equals("N"))
                {
                    break;
                }
        }

                        
        while(!isDone)
        {
            menuChoice =
                    JOptionPane.showInputDialog("Please enter the letter for "
                    + "your selection: " +
                    "\n    A - Display all data" +
                    "\n    B - Display data of specific Subscriber" +
                    "\n    C - Display names of Subscribers with specific "
                    + "friend" +
                    "\n    D - Quit").toUpperCase().charAt(0);
            
            while(menuChoice!='A' && menuChoice!='B' && menuChoice!='C'
                    && menuChoice!='D')
            {
                JOptionPane.showMessageDialog(null, "Sorry, you must choose"
                        + "one of the valid menu choices. Try again.");
                menuChoice =
                    JOptionPane.showInputDialog("Please enter the number for "
                    + "your selection: " +
                    "\n    A - Display all data" +
                    "\n    B - Display data of specific Subscriber" +
                    "\n    C - Display names of Subscribers with specific "
                    + "friend" +
                    "\n    D - Quit").toUpperCase().charAt(0);
                
                switch(menuChoice)
                {
                    case 'A': 
                        break;
                    case 'B':
                        break;
                    case 'C':
                        break;
                    case 'D':
                        isDone = true;
                        break;                 
                }
            }
        }

When line 11 is reached, it does not enter the while loop, but instead simply sits in the terminal running forever. It's probably an obvious answer, but I'm stuck!

Thanks a lot!

Are you sure what is happening?
Debug the code by Adding some printlns to show where the execution flow is going.
Print out the value of the variables that are used as control.

I decided to use

System.out.println

methods as opposed to the JOptionPane ones as I'm still relatively new to them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.