logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • What is Shallow and deep cloning in Java?


  • Correct Answer
  • 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 


  • Technology problems


    Search Results


    • 1. Why do we need wrapper classes in Java?
    • Discuss
    • 2. How does thread synchronization occurs inside a monitor?
    • Discuss
    • 3. What is Auto boxing and unboxing?
    • Discuss
    • 4. What are Native methods in Java?
    • Discuss
    • 5. What is the SimpleTimeZone class?
    • Discuss
    • 6. What is the similarity between Dynamic Binding and linking?
    • Discuss
    • 7. What is dynamic method dispatch?
    • Discuss
    • 8. What are pass by reference and pass by value ?
    • Discuss
    • 9. Explain different ways of creating a thread. Which one would you prefer and why ?
    • Discuss
    • 10. What is the difference between processes and threads ?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment