If the user inputs a name less than six characters the programprompts them to do
ID: 3614337 • Letter: I
Question
If the user inputs a name less than six characters the programprompts them to do it again and tells them that they should input aname more than six characters long. My problem is that after thatwhen the user inputs a name more than six characters the loopcontinues it does not stop. How can solve this problemimport javax.swing.*;
public class length
{
public static void main (String []nyasha)
{
String aString =JOptionPane.showInputDialog("Whats your name");
int length =aString.length();
int num=6;
while ( length<num)
{
JOptionPane.showMessageDialog(null,"Enter a namemore than six characters long");
aString =JOptionPane.showInputDialog("Whats your name");
}
}
}