how would you go about searching lets say i have program like this

Code:
 class records 
{
               string name ;
                int age; 
               
void acceptvalues() throws IOException
{
//buffreader etc 
system.out.println("Enter name");
name = input.readLine());
system.out.println("Enter name");
name = input.parseInt(input.readLine());

}
void printrecords()

{
	print name 
	print age 
}

main()
{
	records objrecords[] = new records[5];

	for loop int i 
		objrecords[i] = new records();
		objrecods[i] = records();
	end of loop 

	printinf loop int k
		objrecords[k].printrecords();
}
would like to give the user an option to print the 1 single record at a time..  
searching by  name .. how would i accomplish this...  

thanks