5 years ago in Java Socket Programming

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);
ois.close();
System.out.println(ois.available());
}
catch (Exception e) {
System.out.print("deserialization");
System.exit(0);
}
}
}

[A] 1
[B] 2
[C] 3
[D] 4
Loading...
Next Question

Overall Stats

Attempted 77
Correct 6
Incorrect 25
Viewed 46

Answers

Guest
Guest
Vaibhav Bisht
Vaibhav Bisht - 1 month ago

Vaibhav Bisht from Dehradun, India is saying 2 is correct answer

Kaneez Khadija
Kaneez Khadija - 2 months ago

Kaneez Khadija from Gujranwala, Pakistan is saying 3 is correct answer

pavithra p
pavithra p - 8 months ago

pavithra p from Bengaluru, India is saying 3 is correct answer

Rania Waleed
Rania Waleed - 9 months ago

Rania Waleed from New Cairo, Egypt is saying 1 is correct answer

shashwat
shashwat - 10 months ago

shashwat from Mumbai, India is saying 2 is correct answer

Related Questions

Which of these package contains classes and interfaces for networking?

  • [A] java.io
  • [B] java.util
  • [C] java.net
  • [D] java.network