FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/day21/code/java/ForDemo2.java at master · devenc/Java · GitHub
devenc
/
Java
Public
forked from
DuGuQiuBai/Java
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
day21
/
code
/
java
/
ForDemo2.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (33 loc) · 698 Bytes
Breadcrumbs
Java
/
day21
/
code
/
java
/
ForDemo2.java
Copy path
File metadata and controls
37 lines (33 loc) · 698 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
for循环的格式:
for(初始化语句;判断条件语句;控制条件语句) {
循环体语句;
}
执行流程:
A:首先执行初始化语句
B:其次执行判断条件语句,看其返回值
如果是true,就继续
如果是false,循环结束
C:执行循环体语句
D:执行控制条件语句
E:回到B
*/
class
ForDemo2
{
public
static
void
main
(
String
[]
args
) {
//在控制台输出10次HelloWorld
for
(
int
x
=
0
;
x
<
10
;
x
++) {
System
.
out
.
println
(
"HelloWorld"
);
}
System
.
out
.
println
(
"--------------"
);
//初始化不从0开始
for
(
int
x
=
1
;
x
<=
10
;
x
++) {
System
.
out
.
println
(
"HelloWorld"
);
}
for
(
int
x
=
1
;
x
<
11
;
x
++) {
System
.
out
.
println
(
"HelloWorld"
);
}
for
(
int
x
=
10
;
x
>
0
;
x
--) {
System
.
out
.
println
(
"HelloWorld"
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL