Shows how to save a Date object to a file?

Answer

Code Sample 1: SaveDate.java


import java.io.*;
import java.util.Date;

public class SaveDate {

public static void main(
String argv[]) throws Exception {

FileOutputStream fos =
new FileOutputStream("date.out");

ObjectOutputStream oos = 
new ObjectOutputStream(fos);

Date date = new Date();
oos.writeObject(date);
oos.flush();
oos.close();
fos.close();
}

All sockets Questions

Ask your interview questions on sockets

Write Your comment or Questions if you want the answers on sockets from sockets Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---