Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Display set names
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Lakshmi
Display set names
1 Answer(s)      2 years and 10 months ago
Posted in : Java Beginners


If i enter the First letter of a name it will display the list of names starting with that letter in command prompt using java


Advertisement
View Answers

February 11, 2012 at 12:12 PM


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]);
            }
        }
    }
}


Related Tutorials/Questions & Answers:
Display set names
Display set names  If i enter the First letter of a name it will display the list of names starting with that letter in command prompt using java   import java.util.*; class DisplaySetOfNames{ public static void
Display set of names from array
Display set of names from array In this section, you will learn how to display the set of names from array. In the given code, we have declared an array... element, it will display the set of countries name from the array. Example
Advertisements
Display set of names in array when we press the first letter
Display set of names in array when we press the first letter  Please help to write a program which have to display set of names in the array when we... the available names)using java   Have a look at the following link
The query used to display all tables names in SQL Server.
The query used to display all tables names in SQL Server.  What is the query used to display all tables names in SQL Server (Query analyzer
Names
: JOptionPane.showMessageDialog(null,"Invalid"); } } }   Display name which starts
display a list of names(when we press first letter)
display a list of names(when we press first letter)  If i gave 1character the name start wth that characteer has to be displayed... using java   import javax.swing.*; class Name { public static void main (String
HOW TO DISPLAY 2 SET OF CONTROLS
HOW TO DISPLAY 2 SET OF CONTROLS  i can be display one row by selecting value from drop down box BUT ALSO i need to display 2 rows by selecting value from drop down box of textbox's and radio button,drop down box using this code
JNDI names in netbeans
JNDI names in netbeans  how to create a JNDI names in netbeans
ipad default image names
ipad default image names  i have a problem while launching application in iPad. The Default image that i have set is not displaying in landscape mode correctly. please suggest. Thanks.   ipad Default image names
Sorting Country names alphabetically
Sorting Country names alphabetically  Hello, I have a list of country names in an array. I need a jsp code which will sort me the country names in an alphaberical order. It would be more useful when I get the coding using
pass parameter names and values
pass parameter names and values  What is the <jsp:param> standard action?   The <jsp:param> standard action is used with <jsp:include> or <jsp:forward> to pass parameter names and values
Chaldean universal identifications names compiler on the application for Funtepoz
Chaldean universal identifications names compiler on the application for Funtepoz  I want to set up criteria on application table. It is chaldean numerology. I want 30 letters and 4 names in the identification and L and E should
display
display  please tell me how to display the content from database.. if we click on any image using servlets/jsp...please
Java set example
Java set example In this section you will learn about set interface in java. In java set is a collection that cannot contain duplicate element. The set... to add duplicate elements in the set. The set interface has method which
Java Set Iterator
Set Interface keeps the data without duplicate value. Its one subtype... data. It uses iterator() method to traverse the data Java Set Iterator...(String[] args) { Set s = new HashSet(); s.add("car
Java Set iterator with example
Java Set Interface keeps the data without duplicate value. Its one subtype... Set Iterator import java.util.*; public class setiterator { public static void main(String[] args) { Set s = new TreeSet(); s.add(1000); s.add
Class names don't identify a class - Java Tutorials
Class names don't identify a class In JDK 1.2 the Sum Microsystems have added a new feature that allows you to identify a class not only by its name but also by its context for which it was loaded. For this you need to set
Display Information
Display Information  I have a listbox having many names and I have a button "display". I select some names and when I click the button , the names along with the address(they are in database) should be displayed. I am using php
SET and SELECT
SET and SELECT  hello, What is difference between SET & SELECT in sql????   hii, SET : The set statement is used to the update query. SELECT : The select statement is used to display the all data's in the table
Jdbc Get Column Names
Jdbc Get Column Names       The JDBC Get Column Names return you the property of the retrieved... The Tutorial illustrates an example from JDBC Get Column Names The Program
Need to know struts1 all jar file names
Need to know struts1 all jar file names  Hi, My name is Neeraj, I want to know all the jar file names for struts1 and plz provide me the link to download these files. Thanks & Regards Neeraj
print selected checkbox names in array without form tag
print selected checkbox names in array without form tag  Hi everyone...;% %> [/code] so, i want to display all seleced checked checkbox names, when i click on button but without using FORM tag
SQL All Column Names
SQL All Column Names       SQL All Column Names is useful when you want to see the Field, Type, Null... on 'SQL All Column Names'. To understand and grasp the example we create a table
Chaldean universal identifications names compiler on the application for Funtepoz1
Chaldean universal identifications names compiler on the application for Funtepoz1  In which programme this VBA can be writen: Function Tryme(mycell) mylen = Len(mycell) For j = 1 To mylen mytest = UCase(Mid(mycell, j, 1
Count number of occurences and print names alphabetically in Java
Count number of occurences and print names alphabetically in Java  I have this code: public class Names { public static void main(String[] args) { String[] s = {"bob", "tom", "jim", "tom", "tom", "tim"}; printCount(s); } public
List the names of classes used to create button and text box in Java.
List the names of classes used to create button and text box in Java.  List the names of classes used to create button and text box in Java
Baby names iPhone, Baby Names Application, Baby name iPhone app, iPhone Baby Names, iPhone baby apps,iPhone baby application
Baby names iPhone - Baby Names Applications for iPhone Baby names iPhone Baby name iPhone app - Search baby names from over 70,000 baby names... the users to search unique and versatile names for their cute and sweet babies
JDBC: Listing Table names Example
JDBC: Listing Table names Example In this section, we are describing how to list all table names of a database using JDBC API. List Tables name in Database : DatabaseMetaData is an interface, implemented by driver which helps user
Set interface
Set interface  hello,, What is the Set interface?   hii, The Set interface provides methods for accessing the elements of a finite... is the example of Set Interface in Java. import java.util.*; public class
iPhone Baby Name App, iPhone Baby Name, Baby Names application for iPhone
iPhone Baby Name App - World Baby Names... Application containing more than 70,000 baby names... with more than 70,000 names to search from. Use our free iPhone Baby Names
 

 

 

DMCA.com