I have this simple project that I'm sure has come throught here before. I am take input from a user using JOptionPane, make sure it is >15 Chars, and count the uppercase.
Here is what I have so far. I am having trouble setting the first loop correctly.

import java.io.*;
        import javax.swing.JOptionPane;


public class WordCount { //using JOptionPane to take input from user and displaying it in dialog box.
  public static void main(String[] args)throws IOException {
    String userInput;
     {
            userInput = JOptionPane.showInputDialog(" Please enter your 15 characters: ");
            JOptionPane.showMessageDialog(null, "You entered: " + userInput);
             }
            int len = userInput.length();
                 
            while(len < 15){
            JOptionPane.showInputDialog(" Please enter at least 15 characters ");
            
        }
}
        
}

Your brackets are all over the place. You open them and you don't close them correctly. Start over and this whatever opens close it, and write code inside it.

At the while loop you don't update the len value inside it. You say that "Please enter at least 15 characters" have to be entered but then you don't anything about it. The loop will continue running and the len doesn't change.
Shouldn't you do something to change it?

Hi,

I rewrote your code, but I haven't compile it so, this is your assignment to do. Here's the code.

public class WordCount{
    public static void main(Strings[] args){

        String userInput = "";

        while(userInput.length() < 15){

            userInput = JOptionPane.showInputDialog("Please enter your first 15 characters: ");     

        }

        JOptionPane.showMessageDialog(null, "Thanks :)!!");

    }//end of the entry point

}//end of the class

I hope this benefits you. Happy coding :)

EL-Prince

commented: Still no code tags and not giving a chance to the poster to learn -1
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.