Home Tutorial Java Scjp Part11 SCJP Module-11 Question-8


Share on Google+Share on Google+
SCJP Module-11 Question-8
Posted on: July 20, 2010 at 12:00 AM
The Sample example given below will test your understanding about the FileOutputStream class.

Given a sample code:

1    import java.io.*;

2    class Test implements Serializable {
3    private static final long serialVersionUID = 1L;

4    public static void main(String[] args) {
5    Test f = new Test();
6    try {
7    FileOutputStream fs = new FileOutputStream("serializable.ser");
8    // Place code here
9    os.writeObject(f);
10  os.close();
11  } catch (Exception ex) {
12  ex.printStackTrace();

What will be placed at line no 8 for successful serialization ?

(A) ObjectOutputStream os = new ObjectOutputStream(fs);
(B) New dataOutputStream(os);
(C) New dataOutputStream(new OutputStream(os));.
(D) DataOutputStream(os);




Related Tags for SCJP Module-11 Question-8:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 20, 2010

Recommend the tutorial

Advertisements Advertisements