Constructor |
Method |
1. Name of constructor must be same with the name of class |
1. For method there is no such type requirement.Methods name can be any kind depends on person choice. |
2.In constructor chaining there is no explicitly constructor. Constructor is invoked implicitly |
2. Method is invoked explicitly |
3. Constructor does not have any return type |
3. In method there can be return type and return something |
4. Constructor can provides a default constructor if you don't have any constructor |
4. java compiler can't provide method |
0 comments:
Post a Comment