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

Java知识分享网

        
AI编程,程序员挑战年入30~100万高级指南 - 职业规划
SpringBoot+SpringSecurity+Vue权限系统高级实战课程        

IDEA永久激活

Java微信小程序电商实战课程(SpringBoot+VUe)

     

AI人工智能学习大礼包

     

PyCharm永久激活

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

     

Cursor+Claude AI编程 1天快速上手视频教程

     
当前位置: 主页 > 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--;
}
 
 
 
 

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


锋哥推荐