Home Answers Viewqa Java-Beginners java program(Hash Table)

 
 


Manish
java program(Hash Table)
1 Answer(s)      4 years and 6 months ago
Posted in : Java Beginners

View Answers

December 4, 2008 at 11:19 PM


Hi friend,

Code to solve the problem :

import java.util.*;

public class HashTable {

public static void main(String args[]) {
Hashtable table = new Hashtable();

//Put value into the table
table.put("Delhi", "India1");
table.put("Mumbai", "India2");
table.put("Kolkata", "India3");
table.put("Cheenai", "India4");
if(args.length>0)
{
String keyCity = args[0];
if(table.get(keyCity)!=null)
{
System.out.println("Country is :" + table.get(keyCity) );
}
else
{
System.out.println("City Not Found");
}
}
else
{
System.out.println("Please enter City");
}

}
}

Thanks









Related Pages:
java program(Hash Table) - Java Beginners
java program(Hash Table)  Store the names of 10 major cities and the names of corresponding countries in a hash table. Accept the name of a city... argument or specifies a city that is not in the hash table.  Hi friend
Creating a Hash Table
Creating a Hash Table : Java Util   ... table. What is the hash table and how to create that? Hash Table holds... for several values. Hash Table is created using an algorithm (hashing function
Simple Hash Table implementation in Java
Simple Hash Table implementation in Java       This section describes the complete Hash Table... in the hash table. Here is the code of the program
Java Hash table
Java Hash table   Hi I have to create code to allow the insertion of a sequence of numbers into a hash table,using a fixed size hash table. Then i... of numbers; insert these into the hash table. Can anyone give me any help
Hash Table for maintaining popup menus in Java
of maintaining popup menus through hash table in your Java program. This section... Hash Table for maintaining popup menus in Java  ... to create and maintain popup menus in Java. All the elements listed in the hash
Partial Search from Hash Table in Java
string in the Hash Table through the Java program and get these string easily. Here... Partial Search from Hash Table in Java   ... to put some string in the Hash Table of Java and get it for searching. This is done
Thread Access through the Hash Table in Java
Thread Access through the Hash Table in Java  ... is accessed by using the hash table in Java.      Here is the code of the program:        
Example to show Hash table exception in java
Example to show Hash table exception in java... of using exception class in java. This tutorial describes  the way to handle Hash table exceptions appropriately in your programs and designs. The steps
Writing and reading from/to a serialized file through Hash Table in Java
Writing and reading from/to a serialized file through Hash Table in Java... value in a hash table in the program.  Here is the code of the program... illustrates you how to read and write from/to a serialized file through the hash table
Hash table
Hash table  Hi guys.. I have question about hash table How to implement a hash table of English words? with these methods ïâ??· A method put(s...() which returns the number of strings in the table. ïâ??· A hash method
Decreasing process time by caching through the Hash Table in Java
Decreasing process time by caching through the Hash Table in Java... by your java program. You can easily improve the process completion time... class, which returns the value existed in the hash table corresponding
Example to show Hash map exception in java
-value pairs Understand with Example Hash map in java is same as the Hash table... Example to show Hash map exception in java  ... on Hash table. Interface in Mapping -  1)The Hash Map implements map. 2
hash function for java strings
hash function for java strings  hash function for java strings   int hash=7; for (int i=0; i < strlen; i++) { hash = hash*31+charAt(i
java program
java program  Problem 2 Note:Use prompt command to input values and use document.write command to display the output. Write a JavaScript program... and display the Point Equivalent based on the table below. Indicate also the remarks
java program
java program  Problem 2 Note:Use prompt command to input values and use document.write command to display the output. Write a JavaScript program... and display the Point Equivalent based on the table below. Indicate also the remarks
hash map
hash map  write a program in hash map , that shows the value in asending order. but not key value. ex: key value ==== ===== k5 ashutosh k1 babita k7 debasis k2 vikas plz help me
program for Hashmaps - Java Beginners
a hash table as the underlying data structure to represent a set. A LinkedHashSet...program for Hashmaps  I need a program that illustrates the concept...[] args) { HashMap hash = new HashMap(); hash.put("Amardeep", new Double
Java Program - JDBC
Java Program  A java program that display in in a table in JTable
program
program  program of jdbc using ms access for creating table
program
program  write a html program in show table and this word in box
program
program  write a program different between to dates in terms of days in java
java program - Java Beginners
java program  i have two classes like schema and table. schema class has fields like schema name and set of tables(3), table class has fields like name, catelogue,columns, primarykeys, foreignkeys. so i need to write 2 java
program
program  develop a servlet to insert the data in the database from our program in the table stored in the database
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
Java Program - Java Beginners
Java Program  Write a program that converts a decimal number to Roman...[] table = { new Roman(1000, "M"), new Roman( 900, "CM... StringBuffer(10); for (Roman rvalue : table) { while (n >
java program - Java Beginners
result in displaying the ratings table and then exiting the program. 2...java program  plzzzzz help me on this java programming question? hello people.. can u plzzzzzzzzzzzzzzzzzzz help me out with this java programm. its
program
program  explanation of program on extending thread class   Hi Friend, Please go through the following link: Java Threads Thanks
program
program  write a java program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
java web program
java web program   A stateLess Session Bean program has... program to create table customer , insert values into the table customer and display customer details. please send the program as soon as posbile
java program - Java Beginners
java program  ahm... i will use a table, text field and a button in java... a user will input a data to be search in the table.. after searching...://www.roseindia.net/java/example/java/swing/ Thanks Amardeep
Swing Program
Swing Program  Write a java swing program to search the details of the students. Searching is performed on student's first name. The details of all... will be displayed in a table, and also delete a selected record from a table. Use JDBC
Hash value is not same - Java Beginners
Hash value is not same  Hi, I've two Excel files with same data.... I've generated one way hash using SHA-1 algorithm. But the hash value of Excel 2003 files is not same as the hash value of Excel 2007 file. What might
program
is working in Java department and salary is 10000". Instantiate the Employee class
program
= con.createStatement(); ResultSet rs = st.executeQuery(qry); // Sending table...("<html>"); pw.println("<body>"); pw.println("<table
Java Program - JDBC
Java Program  A java Program that display data from a Table... table = new JTable(data, columnNames); TableColumn col; for (int i = 0; i <...); col.setMaxWidth(250); } JScrollPane scrollPane = new JScrollPane( table
Program
is then calculated. For this application, we have created a table test
Java Program - Development process
Java Program  Hello Sir ,I want Java Project that Displays Bus Time Table and also Search ,add ,update,Delete Times of Buses also Find Route Of Bus How i can develop it in Java with Back end lik SQL or Ms Access. plz Give Me
java code to compare two hash map objects
java code to compare two hash map objects  java code to compare two hash map objects
Java Program - JDBC
Java Program  Write a Java Code using swings and display records from a table in ms access and display next,previous,last,first records by click on JButton Placed for displaying Next Record,Previouse Record,Last Record, and First
Using Arraylist or Hash Map - Java Interview Questions
Using Arraylist or Hash Map  what could b the pros and cons changing between Hash Map to Array List
Convert Miles To Kilometers program in java
the table. The program should then print out a table of converted values to 2 decimal...Convert Miles To Kilometers program in java  Write a program to compute a table of distance conversions between miles and kilometres. You should
java program for
java program for   java program for printing documents,images and cards
Java Program
Java Program  A Java Program that print the data on the printer but buttons not to be printed
a Java program
a Java program    Write a Java program to print even numbers from 2 to 1024? Write a Java program to print ? My Name is Mirza? 100 times? Write a Java program to print Fibonacci Series? Write a Java program to reverse a number
One way hash in Java - Java Beginners
One way hash in Java  Hi, What is one way hashing. How to implement it in Java. I've to compare the contents of two files by generating their hash value in Java. Please give some examples. Thank You,  Hi Friend
java program
java program  write a program to print 1234 567 89 10
java program
java program  how to write an addition program in java without using arithematic operator
java program
java program  write java program for constructor,overriding,overriding,exception handling
java program
java program  write a java program to display array list and calculate the average of given array
java program
java program  write a java program to display array list and calculate the average of given array

Ask Questions?

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.