Find jobs | Company-wise jobs
Jobseekers | Employer login
About us Sitemap of www.CareerRide.com Sitemap FAQ related with www.CareerRide.com FAQ Click here to Contact us Contact
       
Submit Resume Free ! | Access Resume Free !
Home Interview Q&A Tutorials Oracle Sql server .NET Java Soft skills CV GD Work from home Online practice test FAQs in PDF Books Jobs FAQs
Interview questions                                 
Java interview questions
Java frequently asked questions
Test your Java skills!
Test your JDBC skills!
Test your EJB skills!
 
Java objects, classes & methods
Java operator  Java variables
Java overloading and overriding
Java abstract classes
Java data types  Java arrays
Java exception  Java events
Java virtual machine
Java input and output
Java URL connections
Java sockets  JNDI
Java applets  Java AWT
Java drawing AWT components
Core java  JDBC  JSP  EJB
J2EE  JNI  Servlets  Struts
Java threading  J2ME  JMS
Java web services  RMI
Internationalization  JavaScript
EJB Architecture  Spring
Java Transaction API – JTA  JBOSS
Java transaction services, JTS
Java GUI Framework interview
SWT/JFace interview
MVC and Jface  JavaServer Faces
Hibernate interview  JAAS
JavaMail interview  Tomcat
MIDP interview
Weblogic interview
Ant interview
Websphere interview
Ruby interview
jQuery interview
Aspect Oriented Programming, AOP
Java design patterns
Java localization
More links
JavaServer Faces 
OpenCms Application Overview 
EJB 3 Entities 
Oracle Web RowSet 
 

Java Shallow and Deep cloning

NEXT>>
Shallow and deep cloning in Java - posted by Amit Satpute

Explain Shallow and deep cloning.

Answer
Cloning of objects can be very useful if you use the prototype pattern or if you want to store an internal copy of an object inside an aggregation class for example.

Deep cloning - You clone the object and their constituent parts.

It should be used when it is inappropriate to separate the parts, the object is formed of, from it.

Shallow cloning - You clone only the object, not their parts. You add references to their parts.

It should be used when it is adequate to have the references added to the cloned object 


Shallow and deep cloning in Java - posted by Vidya Sagar

What is Shallow and deep cloning in Java?

Cloning refers to creating duplicate copies of objects in java.

Shallow Cloning: Shallow cloning is a bitwise copy of an object. New object is created which is an exact copy that of the original one. In case any objects are referring the fields of these objects, just the references are copied.

Deep Cloning: In deep cloning, complete duplicate copy of the original copy is created. Deep cloning creates not only the primitive values of the original objects but also copies all its sub objects as well.

Clonable interface is used to perform cloning in java.

NEXT>>

Related Java links

What is the purpose of Comparator Interface?

Answer: Comparators can be used to control the order of certain data structures and collection of objets too......

Explain the impact of private constructor.

Answer: Private Constructors can't be access from any derived classes neither from another class......

What are static Initializers?

Answer: A static initializer block resembles a method with no name, no arguments, and no return type......

Explain autoboxing and unboxing.

Answer: To add any primitive to a collection, you need to explicitly box (or cast) it into an appropriate wrapper class.....

 
Want to be hunted by potential employers? Just submit your key skills!

Popular FAQs

.NET .Net Architecture ADO.NET Java Oracle C#.NET
VB.NET DOT.NET AJAX ASP.NET NET Framework OOPS in .NET
C++ Sql Server Data warehousing EJB MySQL Linux
PHP UML Networking Testing XML  
 
Copyright © 2008 - 2010 CareerRide.com. All rights reserved.