Hashtable: witting hash data to a file
File destrination

Example

import java.io.*;
import java.util.Enumeration;
import java.util.Hashtable;
public class Test_This {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
//"C:/myjava/my_temp/demo.serial" you may catch customized inputs
Process p1 = new Process();
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String file_name ="";
Process pp = new Process();
pp.method_1();
}
}
class Process
{
String[] first = {"A","B","D","C","F","E","F"};
String[] second = {"1","2","3","5","4","5","6"};

public Process(){System.out.println("Default) constructor");}
public void method_1()throws IOException
//required for streaming
{
System.out.println("Key Values");
Hashtable ht = new Hashtable();
String str = "", str1="";
for(int i = 0; i < first.length; i++)
{
ht.put(first[i], second[i]);
}
System.out.println(ht);
Enumeration e = ht.keys();
System.out.println("-----------");
System.out.println("Key Values");
while(e.hasMoreElements())
{
str = (String)e.nextElement();
System.out.println(str + "\t " +ht.get(str));
}
try
{
//stream needs throws exceptions at the method level
FileOutputStream fout = new FileOutputStream("C:/myjava/my_temp/demo.serial");
System.out.println("--destination accessed");
ObjectOutputStream out = new ObjectOutputStream(fout);
System.out.println("--wrting data----");
out.writeObject(ht);
System.out.println("--closing stream--");
out.close();
}//try block
catch (Exception ec){System.out.println(ec); }
finally {
System.out.println("Adios: All OK");
}
}
}

Note the file with contents, however you need to use read stream to view the contents