Basic computer course, C programming language, Education, Engineering Course, Engineering Courses, Maths Coaching, online computer coaching, PGDCA course coaching, programming course, school computer coaching, training, Uncategorized, Web Design course

What is copy constructor in Java? tccicomputercoaching.com


Constructor in java 
is a special type of method that is used to initialise the object.

Two types of constructors in Java

1. Default constructor( No need to pass parameters)

2. parameterized constructor

Copy constructor

Copy constructor is a parameterized constructor and Copy Constructor is used to create an exact copy of an object with the same values of an existing object.

If you want to make a copy of an object while instantiating, then a copy constructor is used to achieve this. If you pass objects as function argument, it is passed as value, but since it’s a copy of reference it’s  actually pointing to the same memory and thus it becomes call by reference.

To learn more about Constructor, Other topics of Java and Programming Languages

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com/course/

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s