
Please help to write a program which have to display set of names in the array when we click the starting letter (like in gmail if we press the letter it will show the available names)using java

Have a look at the following link:
http://www.roseindia.net/tutorial/java/swing/autosuggest.html

import java.util.*;
class DisplaySetOfNames{
public static void main(String[] args)
{
String[] countries = {"Afghanistan", "Albania", "Algeria", "Andorra", "Angola","Argentina"
,"Armenia","Austria","Bahamas","Bahrain", "Bangladesh","Barbados", "Belarus","Belgium",
"Benin","Bhutan","Bolivia","Bosnia & Herzegovina","Botswana","Brazil","Bulgaria",
"Burkina Faso","Burma","Burundi","Cambodia","Cameroon","Canada", "China","Colombia",
"Comoros","Congo","Croatia","Cuba","Cyprus","Czech Republic","Denmark", "Georgia",
"Germany","Ghana","Great Britain","Greece","Hungary","Holland","India","Iran","Iraq",
"Italy","Somalia", "Spain", "Sri Lanka", "Sudan","Suriname", "Swaziland","Sweden",
"Switzerland", "Syria","Uganda","Ukraine","United Arab Emirates","United Kingdom",
"United States","Uruguay","Uzbekistan","Vanuatu","Venezuela","Vietnam",
"Yemen","Zaire","Zambia","Zimbabwe"};
Scanner input=new Scanner(System.in);
System.out.print("Enter letter: ");
String letter=input.next().substring(0,1);
System.out.println();
for(int i=0;i<countries.length;i++){
if(countries[i].startsWith(letter)){
System.out.println(countries[i]);
}
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.