Skip to content

Commit 01f3b9d

Browse files
Traverse Array
Array In Java
1 parent 7f1df0c commit 01f3b9d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: Array

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Testarray{
2+
public static void main(String args[]){
3+
int a[]=new int[5];//declaration and instantiation
4+
a[0]=10;//initialization
5+
a[1]=20;
6+
a[2]=70;
7+
a[3]=40;
8+
a[4]=50;
9+
//traversing array
10+
for(int i=0;i<a.length;i++)//length is the property of array
11+
System.out.println(a[i]);
12+
}}

0 commit comments

Comments
 (0)