Think in java 答案_Chapter 3_Exercise 5
来源:互联网 发布:用ipad怎么看淘宝直播 编辑:程序博客网 时间:2024/05/01 19:04
阅前声明: http://blog.csdn.net/heimaoxiaozi/archive/2007/01/19/1487884.aspx
/****************** Exercise 5 ******************
* Modify Exercise 4 so that the program exits by
* using the break keyword at value 47. Try using
* return instead.
***********************************************/
public class E05_Break47 {
public static void main(String[] args) {
for(int i = 1; i <= 100; i++) {
System.out.println(i);
// if(i == 47) break;
if(i == 47) return;
}
}
}
//+M java E05_Break47
**The above example includes a commented line of code to use break, as well. The break will exit the for loop, which puts it at the end of main( ), whereas return exits directly from the current method, which happens to be main( ).
- Think in java 答案_Chapter 3_Exercise 5
- Think in java 答案_Chapter 5_Exercise 3
- Think in java 答案_Chapter 5_Exercise 5
- Think in java 答案_Chapter 3_Exercise 3
- Think in java 答案_Chapter 2_Exercise 5
- Think in java 答案_Chapter 4_Exercise 5
- Think in java 答案_Chapter 5_Exercise 1
- Think in java 答案_Chapter 5_Exercise 2
- Think in java 答案_Chapter 5_Exercise 4
- Think in java 答案_Chapter 5_Exercise 6
- Think in java 答案_Chapter 5_Exercise 7
- Think in java 答案_Chapter 5_Exercise 8
- Think in java 答案_Chapter 5_Exercise 9
- Think in java 答案_Chapter 5_Exercise 10
- Think in java 答案_Chapter 5_Exercise 11
- Think in java 答案_Chapter 5_Exercise 12
- Think in java chapter's答案_Chapter 2_Exercise 3
- Think in java 答案_Chapter 3_Exercise 1
- Think in java 答案_Chapter 3_Exercise 3
- 用Struts实现文件上传
- 谁不适合做编程
- Think in java 答案_Chapter 3_Exercise 4
- Access数据库“自动编号”字段归零
- Think in java 答案_Chapter 3_Exercise 5
- java执行.bat文件
- DO IT NOW 现在就动手
- 61条面向对象设计的经验原则
- java 表达式
- 知识共享/源代码管理
- sql server2005
- "'last_insert_id' 不是可以识别的 函数名"的问题的解决
- 紧张的考研结束了~期待姐姐能够金榜题名,能够考上!!!