怎样用if--else语句写一个判断用户输入的是数字还是字符串,急,谢谢
解决方案 »
- 我用了动态创建表为什么,不能插入数据呢?提示could not get next sequence value
- hibernate 更新多条数据如何处理
- tomcat5.0+spring2.5,
- 大家帮以下,jBuilder2006创建webservice
- java获取cgi数据
- webwork的form标签
- 编译java程序时,出现的问题。
- 用javamail做邮件发送的配制问题
- hibernate多对一查询问题
- compcode '2' ('MQCC_FAILED') reason '2009' ('MQRC_CONNECTION_BROKEN')
- 求助:评论功能实现碰到问题,代码如下。
- spring 事务
public class Last27{
public static void main(String args[]){
int[] a=new int[10];
String count="0123456789";
for(int i=0;i<10;i++){
String imput=JOptionPane.showInputDialog("Please input "+i+" number:");
int number=Integer.parseInt(imput);
a[i]=number;
System.out.print(a[i]+"\t");
} System.out.println();
for(int j=9;j>=0;j--){
System.out.print(a[j]+"\t");
}
System.exit(0);
}
}
在这段语句中加入一段代码,判断如果用户输入的是字符,则输出一句话:请输入数字!
if(input_str!=null && input_str.matches("(?i)[^a-z]*[a-z]+[^a-z]*")){
System.out.println("输入的是包含字母");
}else if(***){
System.out.println("输入的是***");
}