adplus-dvertising
frame-decoration

Question

What is the output of this program?
    import java.io.*;
    class streams
    {
        public static void main(String[] args)
        {
            try
            {
	        FileOutputStream fos = new FileOutputStream("serial");
	        ObjectOutputStream oos = new ObjectOutputStream(fos);
	        oos.writeFloat(3.5);
	        oos.flush();
	        oos.close();
	    }
	    catch(Exception e)
            {
	        System.out.println("Serialization" + e);
                System.exit(0);
            }
	    try
            {
	        FileInputStream fis = new FileInputStream("serial");
	        ObjectInputStream ois = new ObjectInputStream(fis);
	        System.out.println(ois.available());		    	
	    }
	    catch (Exception e) 
            {
                System.out.print("deserialization");
	        System.exit(0);
	    }
        }
    }

a.

1

b.

2

c.

3

d.

4

Posted under Java Programming

Answer: (d).4

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. Which API gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from.

Q. Which of these is a return type of getAddress() method of DatagramPacket class?

Q. Which of these method of DatagramPacket class is used to find the destination address?

Q. Which of these class must be used to send a datagram packets over a connection?

Q. Which of these methods of DatagramPacket is used to find the length of byte array?

Q. Which of these method of DatagramPacket is used to obtain the byte array of data contained in a datagram?

Q. Which of these method of DatagramPacket is used to find the port number?

Q. Which of these class is necessary to implement datagrams?

Q. Which of these is a bundle of information passed between machines?

Q. Which of these data member of HttpResponse class is used to store the response from an http server?

Q. Which of these methods is used to know the type of content used in the URL?

Q. Which of these methods is used to know when was the URL last modified?

Q. Which of these transfer protocol must be used so that URL can be accessed by URLConnection class object?

Q. Which of these is a wrapper around everything associated with a reply from an http server?

Q. Which of these class is used to access actual bits or content information of a URL?

Q. Which of these methods is used to know the full URL of an URL object?

Q. Which of these methods is used to know host of an URL?

Q. Which of these exceptions is thrown by URL class’s constructors?

Q. What does URL stands for?

Q. Which of these method is called when http daemon is acting like a normal web server?