What is Constuctor inside Java?

1-constructor is special member of class whose name same as class name .

2 constructor is use to initialize the object state

3 *constructor can not be static

4 *constructor can not be final

5 *constructor can not be extended and inherited(***)

6 constructor will be execute by the jvm at object creation time

7 you can not explicitly call the constructor

 8 if you not create the constructor inside the class the jvm create the default constructor at the object creation time
 9 if you create the constructor (dc,arg dc) inside the class then jvm will not create the any constructor at object creation time
 10 any specifier (public,protected,private,default) allowed with constructor

11 constructor have not any return type ,if you write return type with constructor it treated as normal method

12 constructor can be thrown Exception 13 constructor can be overloaded 


Post a Comment