Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

hashtable java

import java.util.*;  
class Hashtable1{  
 public static void main(String args[]){  
  Hashtable<Integer,String> hm=new Hashtable<Integer,String>();  
  
  hm.put(100,"Amit");  
  hm.put(102,"Ravi");  
  hm.put(101,"Vijay");  
  hm.put(103,"Rahul");  
  
  for(Map.Entry m:hm.entrySet()){  
   System.out.println(m.getKey()+" "+m.getValue());  
  }  
 }  
}  
Comment

hashtable in java

- HashTable don't have null key, sychronized(thread-safe)
  Good for parallel testing
Comment

hashtable

- HashTable don't have null key, sychronized(thread-safe)
good for parallel testing
Comment

HashTable Java

//Java Hashtable
//--------------
  
import java.io.*;
import java.util.*;
  
class AddElementsToHashtable {
    public static void main(String args[])
    {
       
        Hashtable<Integer, String> h1 = new Hashtable<>();
  
        // Initialization of a Hashtable using Generics
        Hashtable<Integer, String> h2 = new Hashtable<Integer, String>();
  
        // Inserting the Elements using put() method
        //                              ------------
        ht1.put(1, "Chris");
        ht1.put(2, "Tony");
        ht1.put(3, "Peter");
        ht2.put(4, "Steven");
  
        // Print mappings to the console (Output)
        System.out.println("Mappings of Hash Table 1 : " + h1);
        System.out.println("Mappings of Hash Table 2 : " + h2);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: what coding language is minecraft 
Java :: Error: Could not find or load main class javafx.controls,javafx.fxml Caused by: java.lang.ClassNotFoundException: javafx.controls,javafx.fxml 
Java :: chenge font android studio 
Java :: find highest value in keyset java 
Java :: advantages of exception handling in java 
Java :: string methods in java 
Java :: integer palindrome in java 
Java :: how to call a function in java 
Java :: in java how to compare two strings 
Java :: recursion in java 
Java :: change status bar text color android programmatically 
Java :: current time stamp android java 
Java :: Date(Long) to integer and back 
Java :: Create class from string variable JAVA 
Java :: hashmap sort ascending 
Java :: java.lang.IllegalArgumentException: View=DecorView@5fd145b[MainActivity] not attached to window manager 
Java :: java singleton 
Java :: how to sort arraylist 
Java :: line break in android xml dynamically 
Java :: html alert box android 
Java :: type of exception in java 
Java :: java stringbuilder set value 
Java :: write in file java 
Java :: sorting collections with comparator java 
Java :: java ints to color int 
Java :: java how to change the length of an array 
Java :: how to create char type with jpa 
Java :: java for loop with index 
Java :: Error: Could not find or load main class Main Caused by: java.lang.ClassNotFoundException: Main 
Java :: Java Create a BufferedInputStream 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =