Question:
What is a constructor?
Author: mirudula laxmiAnswer:
Constructors are special methods whose name is the same as the class name. The constructors serve the special purpose of initializing the objects. For example, suppose there is a class with the name “MyClass”, then when you instantiate this class, you pass the syntax: MyClass myClassObject = new MyClass();
0 / 5 (0 ratings)
1 answer(s) in total