摘要: String str = "abcdedf"; 1.获取字符串长度 int saze = str.length(); 2.查找字符串 indexOf(String s); //字符串s第一次出现的下标 lastIndexOf(String s); //字符串s最后一次一次出现的下标 如果没有检索到字 阅读全文
posted @ 2019-10-22 15:49 梦想不远 阅读(97) 评论(0) 推荐(0)
摘要: 1.while循环 int a = 1; int b = 10; while (a < b) { System.out.println(a); a++; } 先判断再执行。 2.do……while循环 int a = 1; int b = 10; do{ System.out.println(a); 阅读全文
posted @ 2019-10-22 09:50 梦想不远 阅读(91) 评论(0) 推荐(0)
摘要: 1.if……else 2.三元运算 格式: 条件式?值1:值2; 例: boolean a = 20<30?true:false; 3.switch case语句 switch(表达式){ case 值1; 语句; break; case 值2; 语句; break; ... default; 语句 阅读全文
posted @ 2019-10-22 09:30 梦想不远 阅读(108) 评论(0) 推荐(0)