Tuesday, 18 February 2014

35. WAP to print elements of array using for loop.

class For
{
public static void main(String args[])
{
int a[]={12,15,18,21};
String names[]={"kundan","shifali","ankita","chandan"};
for(int i=0; i<a.length; i++)
{
System.out.println(a[i]);
}
for(int j=0; j<names.length; j++)
{
System.out.println(names[j]);
}
}
}

No comments:

Post a Comment