java - reading a hashtable from a text file -
i have 2 files - write.java
, read.java
. write.java file writes hashtable text file , function of read.java read hashtable text file.
write.java:
hashtable hash1 = new hashtable(); hash1.put("1", "hi!"); filewriter filewriter = new filewriter("abc.txt"); bufferedwriter bufferedwriter = new bufferedwriter(filewriter); bufferedwriter.write(hash1.tostring()); bufferedwriter.close();
it writes peroperly text file. read.java has read hashtable abc.txt , add 1 more key value paid. best way achieve this?
read.java:
string dnstemp = "abc.txt"; filereader filereader = new filereader(dnstemp); bufferedreader bufferedreader = new bufferedreader(filereader); string line = bufferedreader.readline(); bufferedreader.close();
but line
variable string...how convert hashtable perform further operations?
use properties instead hashtable. has capability of loading , storing
Comments
Post a Comment