输入验证码程序
package we;
import javax.swing.JOptionPane;
public class we {
public static void main(String args[]){
int m=1;
for(m=1;m<2;)
{ m=2;
String sr;
String sjm = "";
for(int i = 0 ; i < 6 ; i ++)
{
int intVal = (int)(Math.random() * 26 + 97);
sjm = sjm + (char)intVal;
}
sr=
JOptionPane.showInputDialog("请输入验证码:"+sjm);
if(sr.equals(sjm)){
JOptionPane.showMessageDialog(null, "验证通过");
}
else
{JOptionPane.showMessageDialog(null,"验证失败,重新验证");
m=1;}
}
}
}