Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is cloneable interface?

Answers were Sorted based on User's Feedback



What is cloneable interface?..

Answer / niranjanravi

Cloneable interface is a marker interface which doesn't
have any methods in it.

Is This Answer Correct ?    19 Yes 5 No

What is cloneable interface?..

Answer / ramanareddy333

cloneable interface is a marked interface or tagged
interface
that means cloneable interface having no methods but it
can hold the information.

Is This Answer Correct ?    13 Yes 3 No

What is cloneable interface?..

Answer / vandana

it is used to make a clone of a object,every time create a
new instance

Is This Answer Correct ?    7 Yes 4 No

What is cloneable interface?..

Answer / ravikiran(aptech mumbai)

it's a marker interface

Is This Answer Correct ?    6 Yes 4 No

What is cloneable interface?..

Answer / saravanan sagadevan

clonable interface is a marker interface to clone the
object.If we want to clone the object then we have to
override clone method .

public Object clone() throws CloneNotSupportedException(){
try{
super.clone();
}catch(CloneNotSupportedException exe){


}
There are two types of clone 1. Shallow copy 2.Deep copy

1. Shallow Copy:
Default copy is shallow copy . Ex :

Class Person {
private Car car ;
public Car getCar(){
this.car=car
}
public Object clone() throws CloneNotSupportedException
(){
try{
super.clone();
}catch(CloneNotSupportedException exe){


}
When Person object is copied, new perosn object will be
created , but Member object car is shared by both copies.
If you make changes in Car object that will be reflected in
cloned object also.

Deep Copy:
===========
For Deep copy , seprate Parent(Person) and child object
will be created .There two copies will be created

Is This Answer Correct ?    4 Yes 2 No

What is cloneable interface?..

Answer / radhika

Java uses clone() of Object class to copy content of 1
object to other object. Classes can implement Cloneable
Interface to override clone() method of object class.

The following sample code will show the procedure for
implementing cloneable interface.
public class CloneExp implements Cloneable {

private String name;
private String address;
private int age;
private Department depart;
public CloneExp(){

}
public CloneExp(String aName, int aAge, Department aDepart) {

this.name = aName;
this.age = aAge;
this.depart = aDepart;
}

protected Object clone() throws CloneNotSupportedException {

CloneExp clone=(CloneExp)super.clone();

// make the shallow copy of the object of type Department
clone.depart=(Department)depart.clone();
return clone;

}
public static void main(String[] args) {

CloneExp ce=new CloneExp();

try {
// make deep copy of the object of type CloneExp
CloneExp cloned=(CloneExp)ce.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}

}
}

Is This Answer Correct ?    3 Yes 3 No

What is cloneable interface?..

Answer / prashant singh

cloneable interface is a marker interface,found in java.lang package.if we want to clone the object then we have to implement this interface.
if we do not implement it and try to make clone of object then CloneNotSupportedException is thrown.

Is This Answer Correct ?    0 Yes 0 No

What is cloneable interface?..

Answer / sunil kumar

Cloneable is a marker interface present in java.lang package. If we want to copy the object then we are using clone method by implementing our class from Cloneable interface.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Can we create an object of static class in java?

0 Answers  


What is the difference between public, private, protected, and friend access?

0 Answers   Amazon,


how to print a numbers from 1 to 100 with out using control structures?

4 Answers   IBM,


How can we create a synchronized collection from given collection?

0 Answers  


Can It is possible to synchronize the constructor of a Java Class?

0 Answers  


what is use of functional interface in java 8?

0 Answers  


Differentiate Vector and ArrayList?

6 Answers   Max Telecom, Wipro,


Explain Big-O notation with an example

1 Answers  


What is the different types of functions?

0 Answers  


Is simpledateformat safe to use in the multithreaded program?

0 Answers  


How to Sort Strings which are given in List and display in ascending order without using java api.

1 Answers   LIC,


what is the diff between Servletcontext and servletconfig?

5 Answers  


Categories