Examveda

What will be the output of the following Java code?
import java.io.*;
class streams 
{
    public static void main(String[] args)
    {
        try 
        {
      FileOutputStream fos = new FileOutputStream("serial");
      ObjectOutputStream oos = new ObjectOutputStream(fos);
      oos.writeInt(5);
      oos.flush();
      oos.close();
  }
  catch(Exception e)
        {
      System.out.println("Serialization" + e);
            System.exit(0);
        }
  try
        {
      int z;
      FileInputStream fis = new FileInputStream("serial");
      ObjectInputStream ois = new ObjectInputStream(fis);
      z = ois.readInt();
      ois.close();
      System.out.println(x);		    	
  }
  catch (Exception e) 
        {
            System.out.print("deserialization");
      System.exit(0);
  }
    }
}

A. 5

B. void

C. serialization

D. deserialization

Answer: Option A


This Question Belongs to Java Program >> Java Serialization And Networking

Join The Discussion

Related Questions on Java Serialization and Networking

What is Java Serialization?

A. The process of converting an object into a byte stream

B. The process of converting a byte stream into an object

C. The process of converting an object into a text file

D. The process of converting a text file into an object