-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConstructor
More file actions
23 lines (16 loc) · 1.01 KB
/
Copy pathConstructor
File metadata and controls
23 lines (16 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1]What is a constructor
→ Special method of class or structure in object-oriented programming that initializes a newly created object of that type
2]what is a constructor changing
→Constructor training is the process of calling a sequence of constructor
3]can we call A sub class constructor from a superclass constructor
→ yes
4]what happen if you keep a return a type for a constructor
→it will become a method of the class
5]what is a no-arg constructor
→that does not accept any arguments
6]how is a no-arg constructor different from the default constructor
→If we do not create any constructor the Java compiler automatically creates a No-arg constructor during the education of the program this constructor is called the default constructor
7]when do we need constructor overloading
→ having more than one constructor with the same name
8]what is the default constructor explain with an example
→ Is a constructor created by the compiler if we do not define any constructor for a class, string