Tuesday, September 6, 2011

ARRAY

import java.util.*;
class Sam
{
public static void main(String args[])
{
int a[]={10,20,30};
System.out.println(a[2]);

int b[]=new int[4];
b[2]=100;
System.out.println(b[2]);

String s[]=new String[3];
System.out.println(s.length);
for(int i=0;i<s.length;i++)
{
Scanner sc=new Scanner(System.in);
s[i]=sc.nextLine();
}
System.out.println("You Entered");
int j=0;
while(j<s.length)
{
System.out.println(s[j]);
j++;
}
}
}

If U LIKE THE POST FOLLOW THE BLOG

No comments:

Post a Comment