What do you understand by copy constructor in java?



What do you understand by copy constructor in java?..

Answer / Jogender Singh

"A copy constructor is a special constructor in Java that creates and initializes a new object identical to an existing one. It copies the values of all instance variables from an existing object to a new object. The syntax is: CopyConstructorName(Object_to_copy);"

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What are different types of multitasking?

1 Answers  


What are access modifiers?

1 Answers   Infosys,


This is my code i have a doubt class ab implements a,b { public void add() { System.out.println("Hi") } } interface a { public void add(); } interface b { public void add(); } in this code i have two interface implemented in the class has same method.just i want to know which method of interface implemented in the class. interface a or interface b? confused me .

3 Answers  


Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.

1 Answers   Rolta,


How to find the size of an array a)array.length() b)array.length c)array.size() d)array.size

6 Answers   Accenture,


posted in online test

1 Answers  


What is an arraylist in java?

1 Answers  


What is cr keyboard?

1 Answers  


What is Interface?

8 Answers   BMC,


What are the 4 types of characters?

1 Answers  


What is the use of math abs in java?

1 Answers  


Is 0 true or is 1 true?

1 Answers  


Categories