编写程序,利用continue语句实现循环体过滤器,过滤“老鹰”字符串,并做相应的处理,但是放弃continue语句之后的所有代码。即若遇到“老鹰”字符串则进行特定处理,然后使用continue语句跳过一般处理。public class Continue { public static void main(String[] args){ String[] array = new String[] { "白鹭", "丹顶鹤", "黄鹂", "鹦鹉", "乌鸦", "喜鹊", & Read More
posted @ 2014-02-14 17:33
源子陌
Views(1005)
Comments(0)
Diggs(0)
编写程序,是先创建一个字符串数组,在使用foreach语句遍历时,如果发现数组中包含字符串“老鹰”则立刻中断循环。再创建一个整数类型的二维数组,使用双层foreach语句循环遍历,当发现第一个小于60的数组元素,则立刻中断整个双层循环,而不是内层循环。public class Foreach { public static void main(String[] args){ System.out.println("\n-------------中断单层循环的例子-------------"); // 创建数组 String[] array = ne... Read More
posted @ 2014-02-14 17:07
源子陌
Views(1095)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号