Citigroup Interview Question for Java Developers


Country: India




Comment hidden because of low score. Click to expand.
0
of 0 vote

By implementing java.io.Serializable, you get "automatic" serialization capability for objects of your class. No need to implement any other logic, it'll just work. The Java runtime will use reflection to figure out how to marshal and unmarshal your objects.

In earlier version of Java, reflection was very slow, and so serializing large object graphs (e.g. in client-server RMI applications) was a bit of a performance problem. To handle this situation, the java.io.Externalizable interface was provided, which is like java.io.Serializable but with custom-written mechanisms to perform the marshalling and unmarshalling functions (you need to implement readExternal and writeExternal methods on your class).

- Hasit Bhatt October 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You can customize the automated serialization mechanism by implementing the Externalizable interface and overriding its readExternal and writeExternal methods. It can be useful when there is a transient variable in your class and the value can be calculated from the object's state.

- Nora November 03, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

javapapers.com/core-java/externalizable-vs-serializable/

- Manisha February 11, 2014 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More