Share on Google+Share on Google+

Faisal Ansari
Names
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners

Pl correct this program. This program will take character from user and show all the name which start that character.

import javax.swing.*; class Name1{ public static void main (String arg[]){ char ch; String =JOptionPane.showInputDialog(null,"Enter any character"); switch(ch){ case 1: JOptionPane.showMessageDialog(null,"Ali\n Azam\n Afzal\n"); break; case 2: JOptionPane.showMessageDialog(null,"Babar\n Bebo\n Bell\n"); break; default: JOptionPane.showMessageDialog(null,"Invalid"); } } }

Ads

View Answers

February 16, 2011 at 10:42 AM


Display name which starts with particular character

import javax.swing.*;
class Name1{ 
    public static void main (String arg[]){

        String st=JOptionPane.showInputDialog(null,"Enter any character");
        char ch=st.charAt(0);
        switch(ch){
            case 'a': JOptionPane.showMessageDialog(null,"Ali\n Azam\n Afzal\n");
            break;
            case 'b': JOptionPane.showMessageDialog(null,"Babar\n Bebo\n Bell\n");
            break;
            default: 
                JOptionPane.showMessageDialog(null,"Invalid");
            } 
            } 
            }









Related Tutorials/Questions & Answers:
Advertisements
JNDI names in netbeans
JNDI names in netbeans  how to create a JNDI names in netbeans
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
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
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
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
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
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
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 of string consisting of some countries name. We have prompted the user to enter
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
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
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
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
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
print selected checkbox names in array without form tag
print selected checkbox names in array without form tag  Hi everyone ... I have problem in my program. I have hashmap i.e. collection , my... seleced checked checkbox names, when i click on button but without using FORM tag
Get Column names using Metadata in jsp
Get Column names using Metadata in jsp       This section illustrates you how to get column names... an example that retrieves all column names from a database table student1. Create
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
Chaldean universal identification names compilator on the applications for Funtepoz civilization
Chaldean universal identification names compilator on the applications for Funtepoz civilization  maybe this code can be converted in any other language except in javascript and VBA: public object Tryme(mycell) { mylen
Get rows count and get columns names
COUNT ROWS AND GET COLUMN NAMES OF A TABLE   In this program , we count the number of data rows stored in a table.  getcolname.java   import java.sql.*; class getcolname  {   public static void main(String[] args
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
Java program to get column names of a table
Java program to get column names of a table... names we need to have connection with the database and then after we will get... of getColumnCount() methods. Now we can get the column names with the index
Getting Column Names from a database table in Java
Getting Column Names from a database table in Java  ..., you need to know the number of columns and the names of the columns...\jdbc-mysql>java ColumnName Getting Column Names Example! Number
How to create a new text file that contains the file names of the copied files in a new directory? - Java Beginners
How to create a new text file that contains the file names of the copied files... file that contains the file names of the copied files in a new directory... text file that has the file names of those files that I copied in a list
find the sql query for the output having two table names ie, homeworklinks,homework_attachments
find the sql query for the output having two table names ie, homeworklinks,homework_attachments  two tables : homeworklinks, homework_attachments homework
Tutorials   
Java Spring Hibernate Struts Training Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized

Ads

 
Advertisement null

Ads