brainbench cert doubt
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, February 14, 2002 11:47 PM

Please answer this also Sample Code import java.io.*; class C1 implements Serializable { C2 ref; public C1() { ref = new C2("My reference"); } public static void main(String args[]) { C1 cl = new C1(); FileInputStream f = new FileInputStream("mf"); ObjectOutputStream out = new ObjectOuputStream(f); c1.m1(out); } void m1(ObjectOutputStream o) { o.writeObject(this); } } class C2 { String title; public C2(String t) { title = t; } } What information about object "ref" will be written to file "mf"? Choice 1 a numerical reference to object "cl" Ch   More>>
			
Please answer this also
Sample Code
import java.io.*;
class C1 implements Serializable {
C2 ref;
public C1() { ref = new C2("My reference"); }
public static void main(String args[]) {
C1 cl = new C1();
FileInputStream f = new FileInputStream("mf");
ObjectOutputStream out = new ObjectOuputStream(f);
c1.m1(out);
}
void m1(ObjectOutputStream o) { o.writeObject(this); }
}

class C2 {
String title;
public C2(String t) { title = t; }
}
What information about object "ref" will be written to file "mf"?
Choice 1
a numerical reference to object "cl"
Choice 2
a serialized version of the object.
Choice 3
a unique hash code representing the version of C2
Choice 4
the serialized version of the object returned by Class.instanceOf(C2)
Choice 5
none, since a ClassNotSerializableException will be thrown

I will be thankful for ur answer
Thanking you
Arun Kumar
   <<Less
About | Sitemap | Contact