1.

What is the output of this program?
import java.io.*;
public class streams_Example
{
public static void main(String[] args)
{
try
{
FileOutputStream FOS = new FileOutputStream("serial");
ObjectOutputStream OOS = new ObjectOutputStream(FOS);
OOS.writeDouble(1.5);
OOS.flush();
OOS.close();
}
catch(Exception e)
{
System.out.println("Serialization" + e);
System.exit(0);
}
try
{
float p;
FileInputStream FIS = new FileInputStream("serial");
ObjectInputStream OIS = new ObjectInputStream(FIS);
p = OIS.readInt();
OIS.close();
System.out.println(p);
}
catch (Exception e)
{
System.out.print("deserialization");
System.exit(0);
}
}
}

A. 1.07
B. 1.07321754E9
C. 1.07321
D. 2.07321754E9
E. None of these
Answer» C. 1.07321


Discussion

No Comment Found

Related MCQs