Shows how to save a Date object to a file?
Submitted by: AdministratorCode 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();
}
}
Submitted by: Administrator
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();
}
}
Submitted by: Administrator
Read Online Socket Programming Job Interview Questions And Answers
Top Socket Programming Questions
☺ | Socket Programming Interview Questions |
☺ | How does the race condition occur? |
☺ | What Is Socket? |
☺ | Socket Programming in C using TCP with Code? |
☺ | What is the difference between TCP and UDP? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |