public static void main(String[] args) throws Exception { Enumeration names; String str; double bal; Hashtable<Integer,String> table = new Hashtable<Integer,String>(); table.put( new Integer(1111),"Selected"); table.put( new Integer(2222),"Not Selected"); table.put(new Integer(3333),"Not Selected"); table.put( new Integer(4444),"Selected"); System.out.println(" "); System.out.print("Enter Ticket Number: "); Scanner input=new Scanner(System.in); int id = input.nextInt(); Set s =table.entrySet(); Iterator i=s.iterator(); while(i.hasNext()) { Map.Entry map=(Map.Entry)i.next(); int key = (Integer)map.getKey(); String value=(String)map.getValue(); if(id==key){ System.out.println(value); } } } }
Hope that it will be helpful for you. Thanks
August 27, 2009 at 9:42 PM
Thanks alot friend..Your code is too understandable and easy..thanks again
Related Pages:
Hashtable java prog - Java Interview Questions Hashtablejava prog Create a hashtable with some student hall ticket numbers and their results. when we type a hallticket number,it shud display the results? please provide the detail java code for this? thanks in advance
Hashtable java prog - Java Interview Questions Hashtablejava prog Create a Hashtable with some students hall... the results? please provide the java code detaily for this query?thanks... bal;
Hashtable table = new Hashtable();
table.put( new Integer(1111),"Selected
Java hashtable Javahashtable What is hash-collision in Hashtable and how it is handled in Java
java prog java prog find out a string from the collection of string in java
java prog java prog write a java program to accept a file name as command line argument.Append the string "file modified by program" to the end of the same file and print the contents of the modified file
java prog java prog Write a Java applet that inputs a person's date of birth (month, day, year):
ā?¢ Informs the person if the year of birth is a prime number.
ā?¢ Informs the person if the year of birth is a leap year.
ā?¢ Computes
Java collection -Hashtable Java collection -Hashtable What is Hashtable in java collection?
Java collection -Hashtable;-
The hashtable is used to store value... {
public static void main(String [] args){
Map map = new Hashtable
hashtable - Java Beginners
hashtable pls what is a hashtable in java and how can we use... to Roseindia");
Hashtable hash = new Hashtable();
hash.put("amar","amar");
hash.put...://www.roseindia.net/java/
Thanks.
Amardeep
java prog que javaprog que create a class that returns the reverse of each word in the given string. For example if we give
"who are u?" as input, it should return "ohw era u
Doubts regarding Hashtable - Java Beginners
it possible to create a hashtable like this?
java.util.Hashtable hashtable=new...(12,13,10,1));
since we get the key of hashtable from the database.
When I tried... information,
http://www.roseindia.net/java/example/java/util/
Thanks
servlet prog - Java Interview Questions
servlet to jsp? how a thread or request pass from one servlet prog to one jsp prog? is it possible of communicating from servlet to jsp prog? please explain briefly with one java code example? Thanks in advance
Java entry prog. Java entry prog. Dear sir
I will enter the dept code, dept name and insert into dept_mast and save. Pl.
Dept_mast
Dept_code Char(2) Primary key (no duplicate key allowed)
Dept_name Char(25
Java Collection : Hashtable Java Collection : Hashtable
In this tutorial, we are going to discuss one of concept (Hashtable ) of
Collection framework.
Hashtable :
Hashtable.... When you increase the entries in the Hashtable, the product of
the load
Java prog - Java Beginners Java prog Write a program on Java that ask the user to input: Cost of Machine, Life of Machine, Cost of capital in Percentage, in an JOption pane window and that calculates and outputs Annual Lease rent. Hi friend
i
Java Hashtable Iterator
be traversed by the Iterator.
JavaHashtable Iterator Example
import java.util.*;
public class hashtable {
public static void main(String[] args) {
Hashtable hastab = new Hashtable();
hastab.put("a", "andrews
java applet prog java applet prog applet to display scrolling text from right to left in an applet window using thread. text should be accepted by html parameter
NEED A PROG
NEED A PROG whats the program to add,delete, display elements of an object using collecions. without using linked list
Hi Friend,
Try the following code:
import java.util.*;
class CollectionExample
{
public
turbo C prog.
turbo C prog. Is is possible print ASCII value of a alphabets using turbo C prog
The Hashtable Class
The Hashtable Class
In this section, you will learn about Hashtable and its implementation with
the help of example.
Hashtable is integrated... it also stores key/value pair in Hashtable.
But the difference is Hashtable
question "writing prog"
question "writing prog" Hello
I want helping for this question, please
Write a program that reads some friendsā?? names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
Solution to C prog
Solution to C prog Hi,
Pls any body help, why the following prog crashing while running.
#include<stdio.h>
#include<conio.h>
int main(){
int n,*fact(int *n);
printf("Enter the number:");
scanf
make a prog for this query
make a prog for this query write a program implementing interface for personal data n salary details. interface must contain abstract methods.
steps for the program are
1) store the data in text file
2)display salary when emp id
turbo C prog.
turbo C prog. Is it possible to print ASCII value A to Z with out using scan ? also give to simple example of binary search ...
#include<stdio.h>
#include<conio.h>
void main()
{
for(char c='A';c<
Prog Error - JSP-Servlet Prog Error
Place Ad
function Browse()
{
Advertisement Management System
Create Ad
State:
City:
Main Category:
Sub Category:
Title
turbo C prog. Q3
turbo C prog. Q3 What is the difference between if and ladder if ? Describe ladder if with example.
What is the purpose of the parameter passing ? please Describe with example.
if statement is used to write
(ForPro) turbo C prog. Q4
(ForPro) turbo C prog. Q4 I need to learn some easy foxpro program.. for example sum,interchange, loop etc
J2ME HashTable Example
J2ME HashTable Example
To use the HashTable, java.util.Hashtable package must be
imported into the application. Generally HashTable are used to map the keys to
values
Spring Hello World prog - Spring
Spring Hello World prog I used running the helloworld prog code mentioned in
http://www.vaannila.com/spring/spring-mvc-tutorial-1.html
I'm getting null pointer exception. as shown below. I added all the jars and my
prog. using radio buttons for simple calculator prog. using radio buttons for simple calculator import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
class Calculator extends JFrame {
private final Font BIGGER_FONT = new Font
prog. using radio buttons for simple calculator prog. using radio buttons for simple calculator import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
class Calculator extends JFrame {
private final Font BIGGER_FONT = new Font
java
java What is the super class of Hashtable? The Dictionary class is the abstract parent Hashtable
java - Struts
java how to use frames in struts prog --
any sample example prog give
Equals() and Hashcode() - Java Beginners
these methods while using Hashtable? Please Explain it detaily along with an java....
Thanks
can you give one hashtableprog using equals() and hashcode
java - Java Beginners Javahashtable null values How to get if there is null value in the Javahashtable? and is it possible to accept both null and values
Java collection Java collection What are differences between Enumeration, ArrayList, Hashtable and Collections
Java Collection Java Collection What are Vector, Hashtable, LinkedList and Enumeration
Collections - Java Interview Questions
Collections By default, Hashtable is unordered. Then, how can you retrieve Hashtable elements in the same order as they are put inside
Collections in Java
Collections in Java are data-structures primarily defined through a set of classes and interface and used by Java professionals. Some collections in Java that are defined in Java collection framework are: Vectors, ArrayList, HashMap
Java collection Java collection What are differences between Enumeration, ArrayList, Hashtable and Collections and Collection
Java - Java Interview Questions
Java By default, Hashtable is unordered. Then, how can you retrieve
Hashtable elements in the same order as they are put inside? Hi...://www.roseindia.net/java/example/java/util/HashTable.shtml
Thank you for posting
interface variables - Java Beginners
interface variables why interface variable is by default final? what was the necessisity to make it final? plz explain me with good javaprog
java
java why data structures?
The data structures provided by the Java utility package are very powerful and perform a wide range...:
Enumeration
BitSet
Vector
Stack
Dictionary
Hashtable
Properties
These classes
java - Java Interview Questions
to be remember:
*)Hashtable is part of legasy class we can use enumerator interface of this hashtable class.
*)Hashtable will not allow null key nor values... more information to visit....
http://www.roseindia.net/java/example/java/util