File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Constructor
2+
3+ 1. A constructor has the same name as the class.
4+ 2. Default constructor has the access modifier of the class.
5+ 3. A constructor can have any of the 4 access modifiers.
6+ 4. A constructor has no return type.
7+ 5. A constructor cannot be abstract, static, final or Synchronized.
8+ 6. Complier creates a default constructor for ech class if we declare a parameterised constructor then default constructor is not made.
9+ 7. Constructor is called only once.
10+
11+ Constructor Overloading
12+
13+ 1. Multiple parameterised constructor can be used and overloaded.
14+
15+ Constructor Chaining
16+
17+ 1. this() keyword is used to call constructor of the current class while super() is used to invoke the constructor of parent class.
18+ 2. A constructor chaining appears to execute in the opposite direction of chain as the innermost constructor is executed first.
You can’t perform that action at this time.
0 commit comments