ARRAY

ARRAY:-
There is one variable capability wherein we can use one variable to store a list of data and manipulate them more efficiently. This type of variable is called an array.
OR
An array stores multiple data items of the same data type, in a contiguous block of memory, divided in to a number of slots.
To declare an array in JAVA
int[] ages;
int ages[];
ages = new int[100];
OR
int ages[] = new int[100];
SAMPLE PROGRAM:-
public class Test
{
public static void main(String[] arg)
{
String day[] = new String[7];
day[0] = "Mon";
day[1] = "Tue";
day[2] = "Wed";
day[3] = "Thu";
day[4] = "Fri";
day[5] = "Sat";
day[6] = "Sun";

for (int i=0 ; i<7 ; i++)
System.out.println(day[i]);
}
}

Comments

Popular posts from this blog

NICOSIA