GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  Programming  >  Java
Next Question 
 Java  |  Question 1 of 875    Print  

As of now ,what i know abt cloning is that we can make a field to field copy of an object.ie when we clone an object,its state as well as a its behaviour is copied to the cloned object.

My question is what is the neccesity of it? cant we create another object of the same class? so how does its different from cloned object (that is creating another object of that class rather than  being cloned).

is there any security issues coupled with this cloned object? And What is the Concrete purpose of Cloning?


  
Total Answers and Comments: 1 Last Update: September 19, 2005   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 25, 2005 06:55:26   #1  
KV        

RE: As of now ,what i know abt cloning is that we can make a field to field copy of an object.ie when we...
Cloning is necessary. Suppose one of the instance fields of your class is mutable object... so if you are wrting a accessor (getter) for such a field.. u can not return the field 
object itself... as once returned.. the calling method 
or class can tamper it..that ways you are breaking encapsulation in a way that u r giving access to your field which is indeed private... instead, you can return a clone object of the same... which wouldnt affect the state of the class.. even if its tampered with. 

 
Is this answer useful? Yes | No

 Related Questions

As of now ,what i know abt cloning is that we can make a field to field copy of an object.ie when we clone an object,its state as well as a its behaviour is copied to the cloned object.My question is what is the neccesity of it? cant we create another object of the same class? so how does its different from cloned object (that is creating another object of that class rather than  being cloned).is there any security issues coupled with this cloned object? And What is the Concrete purpose of

Latest Answer : No it won't work.Only one main methods is allowed ...

Latest Answer :  In c,there are argc and argv.argc is passed to argv and argv is used to store characters.in java there is only args.we pass a String value to it. ...

Latest Answer :  Interface is a pure(100 %) abstract class. Then why abstract class seperatly? It's the design criteria,For example we are writing one class that has methods implemented which are common to other classes .And some methods are different for ...
Tags : Abstract

Latest Answer : In singleton class ,only one time the instance wil create.Example....public class Sin{  static Sin s=null;    public static void main(String a[])  {      create();     create();     ...

Latest Answer : Below are three signatures:public final void notify()public final void notifyAll()public final void wait(long timeout) ...

What are the restrictions of an applet & how to make the applet access the local machines resources.


Latest Answer : JasperReports is a powerful open source Java reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files.Check this link out http://java-source.net/open-source/charting-and-reporting/jasperreports ...

Latest Answer : class is a blue print for an object which defines the functionality of an object. class also called the template for an object. ...


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

Identifying SQA Issues

Identifying SQA Issues Software Quality Assurance is a good practice that every large scale business should employ IT related businesses have never hesitated to use SQA to ensure that the application they will release for their users or sell to their customers will live up to their expectations Iden
 

Creating XML with the DOM PHP Extension

Creating XML with the DOM PHP Extension In fact the PHP DOM extension is a set of classes that can be used to generate access and manipulate XML data The DOM php script defined in the following listing shows how to generate an XML document based on the result set retrieved from the database mosgoogl
 

ODP.NET - OracleCommand Object

ODP NET More About the OracleCommand Object Till now we have seen OracleCommand working with OracleDataReader OracleCommand is not simply meant for OracleDataReader It has got a lot of functionality for itself Let us see few of the most commonly used features of OracleCommand in this section We will
 

Microsoft AJAX Library - Creating Object Members on the Fly

Creating Object Members on the Fly One major difference between OOP in C and ASP NET and OOP in JavaScript is that JavaScript allows creating object members on the fly" This is true for objects and classes that you create yourself and also for JavaScript s own objects and types as well He
 

Microsoft AJAX Library - Object-Oriented JavaScript

Object Oriented JavaScript Objects and classes are implemented differently in JavaScript than in languages such as C VB NET Java or C However when it comes to using them you ll feel on familiar ground You create objects using the new operator and you call their methods or access their fields using t
 

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

Creating Virtual Business Network

Requirements of Virtual Business Network The sudden expansion of electronic commerce has resulted in many changes in the way business is done globally The virtual business network is the buzz word among the business communities internet community and freelance work seekers Traditional business strat
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

Java and Client Server Models

Java and Client Server Models The Role of Client Servers on the Web Client server models provide the essential mechanisms for working with the Internet In fact most of the World Wide Web is built according to this paradigm In client server models the web browsers run by millions of users are the cli
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape