ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
what is d difference between deep cloning and shallow 
cloning in core java?
 Question Submitted By :: Rams
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is d difference between deep cloning and shallow cloning in core java?
Answer
# 1
Deep cloning - You clone the object and their constituent 
parts.

Shallow cloning - You clone only the object, not their 
parts. You add references to their parts
 
Is This Answer Correct ?    3 Yes 3 No
Nishant
 
  Re: what is d difference between deep cloning and shallow cloning in core java?
Answer
# 2
Deep cloning - You clone the object and their constituent parts.

This kind of cloning is adequated when the parts of the
object make up the object, and can not be separated from it.

A car HAS four wheels, and to clone (copy) a car, I must
clone their four wheels.

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

This kind of cloning is adequated when the parts of the
object are independent of it.

An entry in an address book has the street name, the city
name. To clone that entry, you simply add references to the
street and city names.

That distinction is a little difficult to be done in Java,
but is better understood if you think in terms of databases.

You need deep cloning if the entity requires "cascade
deleting" to be deleted. You need shallow cloning if
"cascade deleting" is not needed.
 
Is This Answer Correct ?    5 Yes 0 No
Sunny
 
 
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
i need example for java abstraction. where we use abstraction and why we need abstraction. Oracle1
What is multiple inheritance & can we implement it in java? Satyam4
Can a for statement loop indefinitely?  3
is java support call by reference and call by value, if supports please explain?  3
Explain Global variables in Packages?  2
What classes of exceptions, thrown by a throw statement?  2
List interface?  2
What are batch updates. in jdbc Corent-Technology2
what do you meant by Runtime Polymorphism? Persistent10
public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } Somebody told me that, == operator compares references of the objects. In the above example even though s1 and s4 are refering to same object(having same hash codes), it is printing s1 and s4 are not same. Can anybody explain in detail why it is behaving like this? Thanks in Advance RavuriVinod TCS3
AWT event listeners extends what interface?  1
What is the life cycle of an Applet ?  1
What do you mean by the term transient? Ericsson4
Name the package that always imported by default?  2
What is the % operator?  2
basic difference b/w ALL types of JDBC driver. Systematix1
what is main difference between architecture,framework and design pattren  1
what is the need of the Ajax? iFlex5
how you will prevent method overriding? HCL4
Can multiple catch statements be used in exceptions ? Wipro4
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com