Java Example – Array Output
The following example demonstrates how to output an array using a loop:
Welcome.java File
public
class
Welcome
{
public
static
void
main
(
String
[
]
args
)
{
String
[
]
runoobs
=
new
String
[
3
]
;
runoobs
[
0
]
=
"
Runoob Tutorial
"
;
runoobs
[
1
]
=
"
Runoob Tools
"
;
runoobs
[
2
]
=
"
Runoob Notes
"
;
for
(
int
i
=
0
;
i
<
runoobs
.
length
;
i
++
)
{
System
.
out
.
println
(
runoobs
[
i
]
)
;
}
}
}
The output of the above code is:
Runoob Tutorial
菜鸟工具
菜鸟笔记
Java Examples