Hashtable isEmpty Example
Hashtable class isEmpty method example.public boolean isEmpty() Tests if this hashtable maps no keys to values.
Here is the code
/**
* @ # IsEmpty.java
* A class repersenting use to IsEmpty method
* of HashMap class in java.util package
* version 19 May 2008
* author Rose India
*/
import java.util.*;
public class IsEmpty {
public static void main(String args[]) {
Hashtable table = new Hashtable();
System.out.println("table is empty :" + table.isEmpty());
//Put value into the table
table.put(1, "A");
table.put(2, "B");
table.put(3, "C");
table.put(4, "D");
System.out.println("table is empty :" + table.isEmpty());
}
} |
Output
table is empty :true
table is empty :false |
|