SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start


From course:

Java

» Start this Course
(Practice similar questions for free)
Question:

What is a constructor?

Author: mirudula laxmi



Answer:

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