import java.io.*;
class ForInLoop
{
public static void main(String args[])
{
int a[ ]=new int[10];
a[0]=1;
a[1]=2;
a[2]=3;
a[4]=5;
a[5]=6;
a[6]=7;
a[7]=8;
a[8]=9;
for(int i:a)
{
System.out.println(i);
}
}
}
conclustion:
---If there is no element at last or in-between It will gives 0 at that place
---ex..there is no element at index 3 then a[3]=0;
class ForInLoop
{
public static void main(String args[])
{
int a[ ]=new int[10];
a[0]=1;
a[1]=2;
a[2]=3;
a[4]=5;
a[5]=6;
a[6]=7;
a[7]=8;
a[8]=9;
for(int i:a)
{
System.out.println(i);
}
}
}
conclustion:
---If there is no element at last or in-between It will gives 0 at that place
---ex..there is no element at index 3 then a[3]=0;
No comments:
Post a Comment