dcsimg
Brainbench certification doubt
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

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

Anybody please help me out with the answer for this question. I am giving u the choices also.I also want the explanation for ur answer The question is as follows: Sample Code import java.io.*; class C1 implements Serializable { C2 ref; public C1() { ref = new C2("My ref"); } public static void main(String args[]) { C1 cl = new C1(); FileOutputStream f=new fileOutputStream(arg[0]); ObjectOuputStream out=new ObjectOutputStream(f); c1.m1(out); } void m1(ObjectOuputStream o) { o.writeObject(this); } } class C2 implements Serializable { String title; public C2(String t) { title    More>>


			
Anybody please help me out with the
answer for this question. I am giving
u the choices also.I also want the
explanation for ur answer

The question is as follows:
Sample Code
import java.io.*;
class C1 implements Serializable {
C2 ref;
public C1() { ref = new C2("My ref"); }
public static void main(String args[]) {
C1 cl = new C1();
FileOutputStream f=new fileOutputStream(arg[0]);
ObjectOuputStream out=new ObjectOutputStream(f);
c1.m1(out);
}
void m1(ObjectOuputStream o) { o.writeObject(this); }
}

class C2 implements Serializable {
String title;
public C2(String t) { title = t; }
}
What information about C2 object "ref" will be written to the file passed in arg[0]?
Choice 1
none
Choice 2
a serialized version of "ref"
Choice 3
a numerical reference to C1 object "cl"
Choice 4
a unique hash code representing the current version of C2
Choice 5
a serialized version of the object returned by Class.instanceOf("C2")

Please help me out as fast as possible. I have a set of questions like this to be clarified.
Thanking U
Arun Kumar

   <<Less
About | Sitemap | Contact