PDA

View Full Version : What does constructor do in class?Why we use copy constructor in class. Is it necessa



saneha
04-24-2011, 06:39 PM
1: What does constructor do in class?

2: Why we use copy constructor in class. Is it necessary?

3: What is meant by "multithreaded" and

Robust memory system?

Vuhelper
04-24-2011, 06:40 PM
Constructor is a method which runs just once on the creation of an object for a class and mostly is used for initializations.
Copy constructor helps in making two different objects with same state.
Java is also a Multithreaded programming language. Multithreading means a single program having different threads executing independently at the same time. Multiple threads execute instructions according to the program code in a process or a program. Multithreading works the similar way as multiple processes run on one computer.
Java has the strong memory allocation and automatic garbage collection mechanism. It provides the powerful exception handling and type checking mechanism as compare to other programming languages. Compiler checks the program whether there any error and interpreter checks any run time error and makes the system secure from crash. All of the above features makes the java language robust.