我想显示“名字的数量”。假设如果我输入两个名字,它应该显示“”你输入了 2 个名字。
导入 javax.swing.JOptionPane;
public class MyName {
public static void main (String args [ ])
{
int option;
String userName;
do
{
option = JOptionPane.showConfirmDialog(null,"Want to enter another Name?");
} while (option == JOptionPane.YES_OPTION);
JOptionPane.showMessageDialog(null, "you have entered" + (number of names) + "names");
}
}