Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!
当前位置: 主页 > Java文档 > Java基础相关 >

Core Java Volume I Fundamentals (Horstmann Cay) PDF 下载


分享到:
时间:2024-01-30 11:58来源:http://www.java1234.com 作者:转载  侵权举报
Core Java Volume I Fundamentals (Horstmann Cay)
失效链接处理
Core Java Volume I Fundamentals (Horstmann Cay)   PDF 下载



 
 
 
 
相关截图:
 


主要内容:


When you declare a variable in the first slot of the for statement, the scope
of that variable extends until the end of the body of the for loop.
for (int i = 1; i <= 10; i++)
{
   . . .
}
// i no longer defined here
In particular, if you define a variable inside a for statement, you cannot use
its value outside the loop. Therefore, if you wish to use the final value of a
loop counter outside the for loop, be sure to declare it outside the loop
header.
int i;
for (i = 1; i <= 10; i++)
{
   . . .}
// i is still defined here
On the other hand, you can define variables with the same name in separate
for loops:
for (int i = 1; i <= 10; i++)
{
   . . .
} . . .
for (int i = 11; i <= 20; i++) // OK to define another variable
named i
{
   . . .
}
for loop is merely a convenient shortcut for a while loop. For example,
for (int i = 10; i > 0; i--)
   System.out.println("Counting down . . . " + i);
int i = 10;
while (i > 0)
{
   System.out.println("Counting down . . . " + i);
   i--;
}
 
 
 
 

 
 
 
------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐