public class TestElseif {
public static void main(String args[]){
int i=7;
/*
* test if else-if
*/
if(i<9)
System.out.println("do run this step1");
else if(i==7)
System.out.println("do run this step"); //donot run this step
/*
* test if
*/
int j=0;
String str="[0-1]";
String str1="[0-9]";
if(String.valueOf(j).matches(str1))
System.out.println("do run here"); //这两个都运行了,
if(String.valueOf(j).matches(str))
System.out.println("do run here"); //
本文通过示例展示了Java中if-else语句及switch语句的应用,并深入探讨了字符串与正则表达式的匹配方法。
9612

被折叠的 条评论
为什么被折叠?



