hi,
this is a mock xam question.
import java.io.*;
import java.net.*;
class Class1 implements Serializable {
String name, address;
URL url;
public Class1(String n,String a,int p) {
name = n;
address = a;
url = new URL("http://domain:" + p);
}
additional code here
How can you prevent object "url" from being saved to file when storing a Class1 object using
java serialization?
1 declare "url" as transient
2 make Class1 abstract
3 implement Externalizable and create a writeObject() method
4 store "url" in another class and reference it from Class1
5 declare "url" as either static or final
could anybody please tell what the right answer is and how?.
with warm regards,
arun.