Professional Documents
Culture Documents
Aspire 2015
Aspire 2015
Program:
import java.io.*;
import java.util.Scanner;
class program1
{
public static void main(String args[])
{
String[] names={Dave, Ann, George, Sam, Ted, Gag, Saj, Agati,
Mary, Sam,
Ayan, Dev, Kity, Meery, Smith, Johnson, Bill,
Williams, Jones, Brown, Davis, Miller, Wilson, Moore, Taylor,
Anderson, Thomas, Jackson};
Scanner sr= new Scanner(System.in);
System.out.println("Enter a name to check");
String name=sr.nextLine();
int count=0;
for(int i=0;i<names.length;i++)
{
if(names[i].equals(name))
count++;
}
if(count!=0)
System.out.println("The Number of occurance of the Name is " + count );
else
System.out.println("Word not Found");
}
}
Next the present integer value is incremented, by a value of 10 and then the control passes to the
next element in the array.
next we have the display the resulted array using the final code:
for (int i=0; i < arraylen; i ++)
{
System.out.println(integerArray[i]);
}