MCQs > IT & Programming > Java > Output of the given 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); } } } }

Java MCQs

What is the output of the given 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);
                        }
            }
        }

        }


Answer

Correct Answer: 4

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it