Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
serialization
:
Content language: English
Русский
What is the result of the program: import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.io.Serializable; public class NewClass { public static void main(String[] args) throws Exception { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ObjectOutputStream oOut = new ObjectOutputStream(bOut); Whole object = new Whole(); oOut.writeObject(object); } } class Whole implements Serializable { public void writeObject(ObjectOutputStream out) { System.out.println("Whole.writeObject()"); } }
serialization
Fields with which keyword modifiers will not be serialized?
serialization
What will be the result of compiling and running the following code: import java.io.*; public class NewClass { public static void main(String[] args) throws Exception { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ObjectOutputStream oOut = new ObjectOutputStream(bOut); oOut.writeObject(new Sub()); System.out.println(""); ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray()); ObjectInputStream oIn = new ObjectInputStream(bIn); oIn.readObject(); } } class Base { private int baseField = getInt(1); public Base() { System.out.print("Base.Base() "); } protected int getInt(int i) { System.out.print(i + " "); return i; } } class Sub extends Base implements Serializable { private int subField = getInt(2); public Sub() { System.out.print("Sub.Sub() "); } }
serialization
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes